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.
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.