View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default VBA - Looking to strip alphanumeric from numeric

Try something like the following:


Dim S As String
Dim Pos As Long
Dim Res As String
S = "ABC123DEF456"
For Pos = 1 To Len(S)
If IsNumeric(Mid(S, Pos, 1)) = True Then
Res = Res & Mid(S, Pos, 1)
End If
Next Pos
MsgBox Res


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Dingo " wrote in message
...
Hi,

I am trying to write a VBA macro that given an input of, say,
"AS9F89A779FA87" will give an output of "98977987". The macro I

want to
write would analyze a given input with mixed alphanumeric and

numeric
characters, and remove the alphanumeric from the numeric.

But I'm stuck....help please!


---
Message posted from http://www.ExcelForum.com/