R
Ron Rosenfeld
How do I modify to extract only the number?
It occurs to me that you may want something a bit more general. One way to do
that is to have "pattern" as one of the arguments of the UDF.
That being the case, you could enter the code below but use the following
functions:
To return the digits plus one letter:
=ReMid(A1,"\d+[A-Za-z]")
To return only the digits:
=ReMid(A1,"\d+")
============================
Option Explicit
Function ReMid(str As String, sPattern As String) As String
Dim re As Object, mc As Object
Set re = CreateObject("vbscript.regexp")
re.Pattern = sPattern
If re.test(str) = True Then
Set mc = re.Execute(str)
ReMid = mc(0).Value
End If
End Function
========================
--ron
Rick, Ron. Thanks for all of your help. I used the modules and they
work great. I love the support on these groups. Very grreatful.
Thanks again..
You're most welcome. Glad to help. Thanks for the feedback.
--ron