Arthur Fuller
fuller.artful at gmail.com
Wed May 16 17:03:38 CDT 2012
Jim, That's only going to work for one specific example. But assuming that your examples are accurate, that is, an indefinite number of alpha chars are perhaps followed by an indefinite number of numeric chars, then the following should work: <vba> Public Function AlphaPart(s As String) Dim i As Integer Dim j As Integer Dim strAlphaPart As String j = Len(s) For i = 1 To j Debug.Print Mid(s, i, 1), IsNumeric(Mid(s, i, 1)) If IsNumeric(Mid(s, i, 1)) Then 'Bingo! strAlphaPart = Left(s, i - 1) Exit For End If Next AlphaPart = strAlphaPart End Function Example: ? AlphaPart("Arthur 123") 'returns "Arthur" I tested it against a few strings and it seems to work as advertised. HTH, -- Arthur Cell: 647.710.1314 Prediction is difficult, especially of the future. -- Niels Bohr