Jyggalag

Active Member
Joined
Mar 8, 2021
Messages
445
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

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.
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,223,950
Messages
6,175,582
Members
452,653
Latest member
craigje92

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