Macro/BA to send email to Specific Email Address based on User Selection

bemp87

Board Regular
Joined
Dec 10, 2016
Messages
102
Hi Community! - I am needing some help trying to configure a macro/vba to trigger which email address to send to based on user selection from a Cell based dropdown list. Below is my code. I can't figure out where I am going wrong..

Essentially the macro should work as follows:

If ActiveWorksheet("Action Form").Range("F6") = "Bob Jones" Then... It should auto populate an email to be sent to Bob, but if cell F6 = Sally Jones then it should auto populate an email to Sally upon pressing a 'Submit' button

On Error Resume Next
With OutMail
If Target.Value = "Bob Jones" Then
myToAdd = "bob.jones@bobjones.com"
ElseIf Target.Value = "Sally Jones" Then
myToAdd = "sally.jones@sallyjones.com.com"
End If
.To = myToAdd
.CC = ""
.BCC = ""
.Subject = "Test"
.HTMLBody = "Test"
.Display 'or use .Display


Any help would be greatly appreciated.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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