Hello,
I've been using regular expression in several custom functions to check and correct various things with addresses. I'd like to create one more function that simply returns True or False in the adjacent cell if the cell with the address contains one of several words. One of the problems will be c/o for "care of". It could be anywhere on the line. Not sure how to escape the back slash either.
Function CHECKADDRESS(strLookIn As String) As String
Dim objRegEx
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True
objRegEx.IgnoreCase = False
CHECKADDRESS = strLookIn
objRegEx.Pattern = "\bStreet\b"
CHECKADDRESS = ("True")
CHECKADDRESS = strLookIn
objRegEx.Pattern = "\bc/o\b"
CHECKADDRESS = ("False")
End Function
Thank you for your help.
Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time. --6StringJazzer
Bookmarks