dfolzenlogen
New Member
- Joined
- Oct 18, 2009
- Messages
- 36
Hi,
Please see the following sample data:
I am trying to use VBA to look at the the Name field and if the field ends with "and/or", "* and", "* &", "* or" to concatenate the Name field with Address_Line_One field [data is from an outside source] . See below:
I can get the code to work EXCEPT when I try to include a search for "* AND/OR". I'm guessing it's because AND/OR are VBA operators. What is the correct syntax so that I can search for this text string?
Thank you.
Please see the following sample data:
Name | Address_Line_One |
ANNIE BELL PRYOR | 3805 RADFORD |
JO ANN WELLS | 7513 BERMEJO RD |
MARK ALAN HANCOCK & | ELIZABETH ANN HANCOCK |
DOMINIQUE TRAN AND/OR | HIEN TRAN |
I am trying to use VBA to look at the the Name field and if the field ends with "and/or", "* and", "* &", "* or" to concatenate the Name field with Address_Line_One field [data is from an outside source] . See below:
VBA Code:
If UCase(Trim(.Range("M2"))) Like "*AND" Or UCase(Trim(.Range("M2"))) Like "* OR" Or UCase(Trim(.Range("M2"))) Like "*&" Or UCase(Trim(.Range("M2"))) Like "* AND/OR" Then
wsTransfer.Range("B17") = Trim(.Range("M2")) & " " & Trim(.Range("N2"))
Else
wsTransfer.Range("B17") = Trim(.Range("M2"))
End If
I can get the code to work EXCEPT when I try to include a search for "* AND/OR". I'm guessing it's because AND/OR are VBA operators. What is the correct syntax so that I can search for this text string?
Thank you.