WongMeister
Sep 20 2007, 07:32 PM
I'm taking my first stab in creating a complex function.
In this part of the code, I have:
If Mid(Mod1, 1, 1) Like "[A-Z]" Then....
But if I want this to change to the exclusion, I get an error message:
If Mid(Mod1, 1, 1) Not Like "[A-Z]" Then...
Does the word "Not" not work when creating a vba function?
JeffK
Sep 20 2007, 08:21 PM
You have to do it a bit differently in VBA than in SQL. VBA recognizes Like as an operator but you have to negate the whole expression rather than the operator.
For example, change this:
If Mid(Mod1, 1, 1) Not Like "[A-Z]" Then...
To this:
If Not (Mid(Mod1, 1, 1) Like "[A-Z]") Then...
Note the placement of the Not operator before the entire Like comparison.
HTH
Jeff
WongMeister
Sep 20 2007, 08:30 PM
Thanks Jeff!
As my short-term memory begins to fade in my adult life, I find it more difficult to remember the specific nuances betwen SQL and VBA...
Thanks again,
Rich
JeffK
Sep 20 2007, 08:43 PM
Happy to help. Good luck with the rest of your "first stab"!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.