NoSuperUserHere
New Member
- Joined
- Sep 7, 2023
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
Hi.
I have a macro that looks at a cell for a name, references another sheet and gets the email that corresponds to the name, and sends an email. I hopped into VBA and thought I entered the correct data to expand my vLookup. The original expression is:
Recipient = Application.VLookup(ActiveSheet.Range("A15").Value, Worksheets("List").Range("A2:B100"), 2, False)
I thought if I expanded the range like so:
Recipient = Application.VLookup(ActiveSheet.Range("A15:A17").Value, Worksheets("List").Range("A2:B100"), 2, False)
I could add more names below cell A15 and have the recipient be multiple people. It's not working. The "To" field is blank and the email doesn't get sent. What am I missing? Do I need to do an "and" statement? Would that look something like this:
Recipient = Application.VLookup(ActiveSheet.Range("A15").Value AND , Application.VLookup(ActiveSheet.Range("A16").Value AND , Application.VLookup(ActiveSheet.Range("A17").Value AND , Worksheets("List").Range("A2:B100"), 2, False)
I have a macro that looks at a cell for a name, references another sheet and gets the email that corresponds to the name, and sends an email. I hopped into VBA and thought I entered the correct data to expand my vLookup. The original expression is:
Recipient = Application.VLookup(ActiveSheet.Range("A15").Value, Worksheets("List").Range("A2:B100"), 2, False)
I thought if I expanded the range like so:
Recipient = Application.VLookup(ActiveSheet.Range("A15:A17").Value, Worksheets("List").Range("A2:B100"), 2, False)
I could add more names below cell A15 and have the recipient be multiple people. It's not working. The "To" field is blank and the email doesn't get sent. What am I missing? Do I need to do an "and" statement? Would that look something like this:
Recipient = Application.VLookup(ActiveSheet.Range("A15").Value AND , Application.VLookup(ActiveSheet.Range("A16").Value AND , Application.VLookup(ActiveSheet.Range("A17").Value AND , Worksheets("List").Range("A2:B100"), 2, False)