Populating the .to for an automated email from a range matching a value

mecerrato

Board Regular
Joined
Oct 5, 2015
Messages
174
Office Version
  1. 365
Platform
  1. Windows
I have this sheet called "Distribution" that contains the name of the project and the emails associated with the project. I am creating an automated email but need to include all the emails for that project.
I currently have the names hard coded in the .to like this:
.To = "ana.chiriboga@lgihomes.com; trey.williams@lgihomes.com; fik.mesheka@lgihomes.com"

But would like to know how I can use VBA code to match the value in a worksheet called "Loans" where the project name is in column F. I know that I can use ActiveSheet.Range("F" & ActiveCell.Row).Value to get the project name but how do I add the email address in worksheet "Distribution" that match the project name?

1674837607984.png
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I have this sheet called "Distribution" that contains the name of the project and the emails associated with the project. I am creating an automated email but need to include all the emails for that project.
I currently have the names hard coded in the .to like this:
.To = "ana.chiriboga@lgihomes.com; trey.williams@lgihomes.com; fik.mesheka@lgihomes.com"

But would like to know how I can use VBA code to match the value in a worksheet called "Loans" where the project name is in column F. I know that I can use ActiveSheet.Range("F" & ActiveCell.Row).Value to get the project name but how do I add the email address in worksheet "Distribution" that match the project name?

View attachment 83940
I posted it on stackoverflow as well to see what idea they can give me
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,716
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top