Like Operator Error
I think you want this pattern...
"[0-9Aa][0-9Dd][0-9Tt]##-#[A-Za-z][A-Za-z]"
Upper case and lower case ranges (separated by a dash) are specified
individually).
--
Rick (MVP - Excel)
"RyanH" wrote in message
...
I am getting an error on this single line of my code: Error #93, "Invalid
Pattern String". This If...Then Statement is used to scan Col.A and
ensure
that the values have a particular format. It works great till it gets to
this number "18075-12". For some reason it is throwing the error and I
don't
know why, any ideas?
Error Not .Cells(i, "A") Like "[0-9Aa][0-9Dd][0-9Tt]##-#[Aa-Zz][Aa-Zz]"
If (Not .Cells(i, "A") Like
"[0-9Aa][0-9Dd][0-9Tt]##-#[Aa-Zz][Aa-Zz]" And _
Not .Cells(i, "A") Like
"[0-9Aa][0-9Dd][0-9Tt]##-##[Aa-Zz][Aa-Zz]") And _
rngProductCodes.Find(What:=Right(.Cells(i, "A"), 2),
LookIn:=xlValues) Is Nothing Then
' highlight bad item number red and bold
With .Cells(i, "A").Font
.ColorIndex = 3
.Bold = True
End With
End If
--
Cheers,
Ryan
|