
Originally Posted by
mancubus
perhaps...
[vba]
Sub FindFirstNumericInString()
Dim LR As Long, i As Long
Dim strTest
LR = Range("C" & Rows.Count).End(xlUp).Row
For R = 1 To LR
IndexI = IndexI + 1 'change the position of this line to your requirement
If InStr(1, Cells(R, 4), "STATUS CODE") > 0 Then
strTest = Split(Cells(R, 4), " ")
For i = LBound(strTest) To UBound(strTest)
If IsNumeric(strTest(i)) Then
Sheet2.Cells(IndexI, 4).Value = strTest(i)
Exit For
End If
Next i
End If
Next R
End Sub
[/vba]
i assume you want to extract the first occurence of a number in the string.
IndexI = IndexI + 1 counter makes the code write walues to corresponding rows in Sheet2. so if this is not the case, its place must be changed.