View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default locating numbers in a text string

Sub Tester11()
Do While Not IsEmpty(ActiveCell)
sStr = ActiveCell.Text
x = 0
For i = 1 To Len(sStr)
sChr = Mid(sStr, i, 1)
If Asc(sChr) = 48 And Asc(sChr) <= 57 Then
x = x + 1
ActiveCell.Offset(0, x).Value = i
End If
Next
ActiveCell.Offset(1, 0).Select
Loop

End Sub

should do what you describe.

--
Regards,
Tom Ogilvy





mcdowell wrote in message
...
I am attempting to sepatate a single string of characters which includes
a middle

sector of numbers beginning and ending at different points. The
procedure needs to

analyze the current cell.... consider each character (loop using
LEN(Xcell)) compare

the character to see if it = "O" thru "9" .. then place the numeric
location point of the

character in a cell in the same row using an ActiveCell.Offset(0,x)
reference. If

multiple numeric characters are found in each string then entries need
to be made in

adjoining columns offset from the ActiveCell. The procedure needs then
to drop to the

line below and perform the process again. I have tried every thing I
know to create a

Sub... using nested loop etc... and I'm baffled.... any help out here??