View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Remove Text From AlphaNumeric

See http://www.ozgrid.com/VBA/ExtractNum.htm

which can handle Decimal and negative values, or not.


Given the OP wants to grab the number which is located at the beginning of
the text, here is a shorter UDF that has the same functionality as your UDF
does for this situation...

Public Function Numerals(Rng As Range, Optional Take_decimal As Boolean, _
Optional Take_negative As Boolean) As Double
Numerals = Val(Rng.Value)
If Not Take_decimal Then Numerals = Replace(Numerals, ".", "")
If Not Take_negative Then Numerals = Replace(Numerals, "-", "")
End Function

--
Rick (MVP - Excel)



"ozgrid.com" wrote in message
...
See http://www.ozgrid.com/VBA/ExtractNum.htm

which can handle Decimal and negative values, or not.



--
Regards
Dave Hawley
www.ozgrid.com
"Bam" wrote in message
...
Hi All,

I have a colmun of Codes, of varying lengths that contains Letters at the
end of each Code.

The letters range from 1 single letter up to a word, again of varying
lengths.

I need to strip out all alpha letters and retain only the numeric
numbers.

Either a fomula or Macro.

Many Thanks,

Bam.