On Tue, 7 Aug 2007 12:28:27 -0400, "Rick Rothstein \(MVP -
VB\)"
wrote:
If sPattern is well defined (as shown in the example), you don't need to use
a Regular Expression to test it... VBA's Like operator is enough...
Sub ChkNum()
Dim c As Range
Dim oRegex As Object
Const sPattern As String = "###.###.####.######.###.##.###"
For Each c In Selection
If c.Text Like sPattern Then
Debug.Print c.Text, "Valid"
Else
Debug.Print c.Text, "Invalid"
End If
Next c
End Sub
That's true.
I was thinking along the lines that if there is some variability in the numbers
of digits allowed between each 'dot', then constructing a regex might be
simpler.
--ron