Extract first four letters from string....
Here is a simple udf that will return the position of the first non-numeric
character in a string. Put it in a standard code module and use it like this
in a cell.
=mid(a1, firstletter(a1), 1)
Public Function FirstLetter(ByVal InputString As String) As Integer
Dim lngCounter As Long
Dim lngStringLength As Long
Dim lngReturnValue As Long
lngReturnValue = -1
lngStringLength = Len(InputString)
For lngCounter = 1 To lngStringLength
If Not IsNumeric(Mid(InputString, lngCounter, 1)) Then
lngReturnValue = lngCounter
Exit For
End If
Next lngCounter
FirstLetter = lngReturnValue
End Function
--
HTH...
Jim Thomlinson
"J.W. Aldridge" wrote:
Hi,
I have a list of codes in column A. I need to extract the first four
letters in every row (disregaurding any numbers or spaces) and paste
them in the same adjacent row in column C.
I also need to do the same for column B to D.
CODE EXTRACTED VALUE
00APPLES APPL
APPLE APPL
APPLE APPL
12313APPL APPL
.....APPLES APPL
Thanx
|