Dear Experts
Would you help i have code using for extract number if 8 Digi combination .. but something wrong for counts if more the eight ... to extracted .
For example :
String : HAL LOCKER # P2018061101136 / T# 96825809 before act .
the code would extracted 20180611 .... Not the 96825809 in string
Thanks very much your help
Would you help i have code using for extract number if 8 Digi combination .. but something wrong for counts if more the eight ... to extracted .
For example :
String : HAL LOCKER # P2018061101136 / T# 96825809 before act .
the code would extracted 20180611 .... Not the 96825809 in string
Thanks very much your help
Rich (BB code):
Public Function GetMy8Digits(cell As Range)
Dim s As String
Dim i As Integer
Dim answer
Dim counter As Integer
s = cell.Value
counter = 0
For i = 1 To Len(s)
If IsNumeric(Mid(s, i, 1)) = True Then
answer = answer + Mid(s, i, 1)
counter = counter + 1
If counter = 8 Then
GetMy8Digits = answer
Exit Function
End If
Else
counter = 0
answer = ""
End If
Next i
End Function