vba, Email multiple addresses with multiple rows

Auke

New Member
Joined
Sep 22, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello, my first post.
I'm looking for a solution with my Excel VBA problem.
Hopefully someone is able to help.

I'm looking for a solution to send multiple emails with outlook to different mailadresses with different rows from my excel file.
Employee nameEmail addressInfo 1Info 2Info 3Info 4Info 5Info 6Info 7
AA@hotmail.comABCDInfo 5Info 6Info 7
AA@hotmail.comABCDInfo 5Info 6Info 7
BB@hotmail.comABCDInfo 5Info 6Info 7
BB@hotmail.comABCDInfo 5Info 6Info 7
CC@hotmial.comABCDInfo 5Info 6Info 7
CC@hotmial.comABCDInfo 5Info 6Info 7

So every employee needs to receive an email with only the rows applying to them.
In this example every employee will receive an email with 3 excel rows in in, the header and the 2 rows related to his name and mailadress.

Is someone able to help me with the code for this?
I've been searching, but I were not able to find the right coding.

Thanks in advance.

Kind regards, Auke
 
Thanks for the quick response.

I'm now getting a run-time error '91': Object variable or with block variable not set. I'm applying this code to a table, so I also tried disabling the autofilter in the beginning, so it doesn't mess with the code, but to no avail unfortunately.

1699023880635.png
 

Attachments

  • 1699023846799.png
    1699023846799.png
    1.8 KB · Views: 6
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I tested the code on some dummy data and it worked properly. It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your sheet. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
 
Upvote 0
I was having the same problem with the aforementioned error, but discovered the macro worked just fine if I converted my source table to a range. I have struggled to edit the code to work with a named Excel table, could a new code be provided to work if the data were in a table? Also, perhaps add on whatever the default email signature is for a given user?
 
Upvote 0
@p2678468
Hello and welcome to the Forum. Please start your own new thread explaining in detail what you want to do and provide a link to this thread if you think it is useful.
 
Upvote 0

Forum statistics

Threads
1,216,082
Messages
6,128,702
Members
449,464
Latest member
againofsoul

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