How to auto-populate email based on Cell Value

bemp87

Board Regular
Joined
Dec 10, 2016
Messages
102
Hi Everyone,

I am trying to make an email automatically prefill with text and a desired email address based on a specific cell value. I am thinking I need to use a IF statement to accomplish what i am trying to do, but i am not coming up with any success, any suggestions?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I looked there first, but i can seem to find what i am looking for, essentially what i need to happen is something similar to 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

The .To email address that should auto-populate should depend on which user i select from the cell F6... Not sure what i'm missing
 
Upvote 0

Forum statistics

Threads
1,215,332
Messages
6,124,314
Members
449,153
Latest member
JazzSingerNL

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