19 March 2016
The VBA Like
operator is something so useful I am often surprised how rarely it is used in Excel and Access VBA.
I often tend to see the Like
operator as the last resort before using Regular Expressions in VBA. It replaces greatly the VBA InStr
function when needing to check if a certain substring is present within a certain string.
The main take-aways are:
- Use the VBA
Like
instead of theInStr
function to check if a string contains a substring. - Consider using the VBA
Like
before resorting to VBA Regular Expressions. - Be sure to master string manipulation too!
Full article: VBA Like operator – using wildcards in conditional statements