This is an adaption of turtle44's response who helped me finish my code with his. Thanks turtle44, I was stuck for a while.
VB:
Sub FindText()
Dim ws As Worksheet
Dim x As Integer, y As Integer, z As Integer
Dim w As String, digit As String, alpha As String
Set ws = Worksheets("Sheet1")
For x = 2 To 7
digit = vbNullString
alpha = vbNullString
y = Len(Trim(ws.Range("B" & x).Value))
For z = 1 To y
w = Mid(ws.Range("B" & x), z, 1)
If IsNumeric(w) Then
digit = digit & w
Else
alpha = alpha & w
End If
Next
ws.Range("C" & x).Value = alpha
ws.Range("D" & x).Value = digit
Next x
End Sub
EDIT - I noticed that I had
VB:
Trim(Len(ws.Range("B" & x).Value))
which does Not make sense. You would want To eliminate the spaces first I think. It should be
Len(Trim(ws.Range("B" & x).Value))
This change is not reflected in the attached workbook
Bookmarks