View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
FiluDlidu FiluDlidu is offline
external usenet poster
 
Posts: 66
Default Remove any letter from a referenced cell

Found it!

Function trimfuss(rng As Range)
Set RegExp = CreateObject("vbscript.RegExp")
With RegExp
.Global = True
.Pattern = "\d{1,}"
End With
Outstring = ""
Set Collection = RegExp.Execute(rng)
For Each RegMatch In Collection
Outstring = Outstring & RegMatch
trimfuss = Outstring
Exit For
Next
End Function


"FiluDlidu" wrote:

Perhaps a bit off-subject, but it's my thread so I guess I can do what I want
from it (can't I?)...

How would you cut out anything beyond the first set of, say numbers, in say
the following string (?):
aBc123Def45
(from the preceding I would like to get "123" only, and drop "45")

Is it too much asking??