View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Remove Text From AlphaNumeric

Very Nice!!
--
Gary''s Student - gsnu201002


"Rick Rothstein" wrote:

How about this simple UDF:

Public Function Numerals(rng As Range) As String
'
' gsnuxx
'
Dim sStr As String, i As Long, sStr1 As String
Dim sChar As String
sStr = rng.Value
For i = 1 To Len(sStr)
sChar = Mid(sStr, i, 1)
If sChar Like "[0-9]" Then
sStr1 = sStr1 & sChar
End If
Next
Numerals = sStr1
End Function


That should work OK so long as there are numerals after the initial set of
numbers.

For example: 123ABC6GH

Your UDF -- 1236 and I suspect the OP would probably want 123


How about this real simple UDF for that condition...

Public Function Numerals(Rng As Range) As Variant
Numerals = Val(Rng.Value)
End Function

--
Rick (MVP - Excel)

.