VBA - Loop/Filter and Send Email

eddymx

New Member
Joined
Mar 29, 2017
Messages
1
Hi,

i want to do the following, from the table below i want to:

1-Filter per column C for unique values
2-Once filtered if its only "1" row, then put each cell on that row into a variable.
3-Once filtered if the results is more than 1 records, meaning the same email address has 2 or more records then grab all the range from A to E (range to HTML).
4- Paste the information in an Email (outlook app 2010).
5-Loop until column B hits a blank cell, which means its the end.

Table Example:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Record ID[/TD]
[TD]Email[/TD]
[TD]Data[/TD]
[TD]Data[/TD]
[TD]Data[/TD]
[/TR]
[TR]
[TD]Record1[/TD]
[TD]test1@test.com[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Record2[/TD]
[TD]test2@test.com[/TD]
[TD]2[/TD]
[TD]2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Record3[/TD]
[TD]test1@test.com[/TD]
[TD]3[/TD]
[TD]3[/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]

At the end, the following emails should be sent or display:
1- One email with 2 rows with all columns from A to E to test1@test.com in a range to Html.
2- one email with 1 row with all columns from A to E to test2@test.com in variable then paste them into HTML.

i need the VBA logic since all the examples i have been reading doesnt fit this exact way i want to do it.

Thank you so much for reading!
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,223,719
Messages
6,174,089
Members
452,542
Latest member
Bricklin

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