W
Wavit11
How will I extract letters from this string
like... to:
AB-123456-45 AB
BCD-678901-23 BCD
E-23454 E
if I this bottom code extract numbers from a the same string:
Function ExtractNum(rCell As Range)
Dim iCount As Integer, i As Integer
Dim sText As String
Dim lNum As String
sText = rCell
For iCount = Len(sText) To 1 Step -1
If IsNumeric(Mid(sText, iCount, 1)) Then
i = i + 1
lNum = Mid(sText, iCount, 1) & lNum
End If
If i = 1 Then lNum = CInt(Mid(lNum, 1, 1))
Next iCount
ExtractNum = CLng(lNum)
End Function
like... to:
AB-123456-45 AB
BCD-678901-23 BCD
E-23454 E
if I this bottom code extract numbers from a the same string:
Function ExtractNum(rCell As Range)
Dim iCount As Integer, i As Integer
Dim sText As String
Dim lNum As String
sText = rCell
For iCount = Len(sText) To 1 Step -1
If IsNumeric(Mid(sText, iCount, 1)) Then
i = i + 1
lNum = Mid(sText, iCount, 1) & lNum
End If
If i = 1 Then lNum = CInt(Mid(lNum, 1, 1))
Next iCount
ExtractNum = CLng(lNum)
End Function