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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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