Cell has formula with IF (generating email addresses). How do I set VBA email to the cell reference?

asiuol84

New Member
Joined
Oct 19, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I have a VBA code to send emails automatically on cell value change. It works perfectly with dummy email addresses in the TO: field, but I want it to send to addresses generated by an IF function.
The VBA doesn't like the cell reference because it contains formula. How do I get around it?
 

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.
Set the cell that has the IF formula as a Named Range. Then replace the cell address in your VBA with the name of the Named Range, surrounded by quotation marks.
 
Upvote 0
Set the cell that has the IF formula as a Named Range. Then replace the cell address in your VBA with the name of the Named Range, surrounded by quotation marks.
The IF formula is in a different sheet... does that matter? Also the IF changes based on other data will that affect the name? I've tried naming it, and referencing the named range, but it still doesn't like it.
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,602
Members
449,089
Latest member
Motoracer88

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