I am trying to use regular expressions in a macro for an Excel document.
Here is what I have so far:
dim regex
regex.pattern = "\s+"
for p = 3 to totalparamcount
if (regex.test(Worksheets("table").Cells(p,1)) then
msgbox ("blah blah")
end if
next
The pattern I am trying to match is one or more spaces, tabs, newlines, which I saw is denoted by "\s".
The line ‘if (regex.test(Worksheets("table").Cells(p,1)) then‘ is getting this error:
Run-time error '424':
Object required
I am using VBA 7.0 in Excel.
You need to create the regexp object, ie