Jyggalag

Active Member
Joined
Mar 8, 2021
Messages
422
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi all,

I currently have the following VBA code attached to a macro that sends out an email and attaches a word file to it when I click it and sends this out to a list of emails (and also BCC's a list of emails):

1643037684249.png


Now I want to edit this file so I can target a list of emails in the emails, BCC and files to send columns from another sheet. If I want to make this edit (let's for simplicity's sake say that I keep my macro in Sheet 1, but move column O (emails), column P (BCC), and column Q (Files to send) to a new sheet I call Sheet 2). How would I need to change my code?

I would greatly appreciate some assistance here!

Thank you all :)

Kind regards,
Jyggalag
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try putting Sheets("Sheet2"). in front of your 'Cells(' in the for next loops that you have.

Example: Cells(i,15) would become Sheets("Sheet2").Cells(i,15)

Do the same for the Cells(i,16) & the Cells(i,17)
 
Upvote 0
Solution
Try putting Sheets("Sheet2"). in front of your 'Cells(' in the for next loops that you have.

Example: Cells(i,15) would become Sheets("Sheet2").Cells(i,15)

Do the same for the Cells(i,16) & the Cells(i,17)

Amazing! It worked!!

And very simple and easy-to-understand solution :)

Much appreciate JohnnyL!! Thank you so much :D

Kind regards,
Jyggalag
 
Upvote 0

Forum statistics

Threads
1,215,308
Messages
6,124,178
Members
449,146
Latest member
el_gazar

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