Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Sienna Hughes   on Mar 06 In MS Office Category.

  
Question Answered By: Lonnie Rogers   on Mar 06

I am not sure if this what you want.

I am assuming you have a column with letters and numbers in each cell (e.g.
"xyz147s" and you want to show "147".

Put the following function in a module - that is a module!!! you need to add a
module to the project in the VBE.

Paste the text in

Look for any red lines where something has got corrupted and correct them.

Then in another column enter the formula stripnumbers(A1) if A1 is the first
cell you want to deal with.

Copy the formula down the length of the column

If you want to fix the results just select, copy, and paste special, values.

If you want to do something else please explain more precisely.

The subject and content seem to be talking about opposite aims.

'### CODE ###
Option explicit

Function stripletters(source As String) As String

'Returns a string comprising only the numbers
target = ""
For x = 1 To Len(source)
thisletter = Mid(source, x, 1)
If Asc(thisletter) > 47 And Asc(thisletter) < 58 Then
target = target & thisletter
End If
Next x
stripletters = target

End Function

'### End of Code ###

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Delete everything in a workbook that is a number Or get search suggestion and latest updates.


Tagged: