Extract alphabet from string.
Hi Jim,
This is what I'm looking for. Thanks.
There are two syntax I don't understand.
1. What's the function of CStr(1)?
2. What's the function of Like "#"?
Bill
-----Original Message-----
Bill,
This works for me...
'--------------------------------------------
'Jim Cone 02/19/2004
Sub FindAlphasOnLeft()
Dim lngNum As Long
Dim lngLength As Long
Dim strExtract As String
Dim strCharacters As String
strCharacters = Range("F8").Text & CStr(1)
lngLength = Len(strCharacters)
For lngNum = 1 To lngLength
If Mid$(strCharacters, lngNum, 1) Like "#" Then
strExtract = Left$(strCharacters, lngNum - 1)
Exit For
End If
Next 'lngNum
If Len(strExtract) Then
Range("J8").Value = strExtract
Else
Range("J8").Value = "No Alpha on left side"
End If
End Sub
'--------------------------------------------
Regards,
Jim Cone
San Francisco, CA
"Bill Choy" wrote
in message
...
Hi all,
Are there any suggestion to extract the first few
alphabet
from a string? For example, "RC125", I want to scan this
string from the first character and extract "RC" to the
other cell. Please suggest a method to recognize
between A-
Z and 0-9. Thanks.
Bill
.
|