Sub Extract_Numbers_Inside_A_String()
' ______________________________________
'
' This macro extracts figures from a string
' and writes them to cell A1
' It works in Excel
' ______________________________________
'
Dim Counter As Integer
Dim myString As String
Dim myValue As Variant
myString = "AFEAJFEOAnuioeujaƩnvniue58123" 'define string
For Counter = 1 To Len(myString)
If IsNumeric(Mid(myString, Counter, 1)) Then
myValue = Mid(myString, Counter, 1)
cells(1, 1).Value = cells(1, 1).Value & myValue
End If
Next
End Sub
No comments:
Post a Comment
You may comment or show me other VBA tricks, but don't rest assured I'll always reply because I only have 24 hours in a day's hard work, and only a few minutes a week to update this blog... I'll try my best though...