Email Pivot Table to Distribution list changing Pivot Table Filter

DarkNight

New Member
Joined
Apr 25, 2017
Messages
17
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm trying to use vba to mass email out a pivot table. The email_address table in column A:B includes a list of states and an associated email. I'm looking to email out the pivot table located in column D:E to each of the emails located in the email_addres table. In each email i need to change the filter on the pivot table to match the associated state.

For example: the first email that should be sent would go to Test_AZ@gmail.com. The body of this email needs to include the pivot table in column D:E with a filter applied for the state located in column A (in this case AZ).
this loop needs to continue for each row in the email_address table. apply the filter in column a to the pivot table. send the email with the pivot table in the body to teh email address located in column B.


let me know if you have any questions. thank you!!!!



Question.xlsx
ABCDE
1StateEmail AddressState(All)
2AZTest_AZ@gmail.com
3IATest_IA@gmail.comRow LabelsCount of City
4INTest_IN@gmail.comBeckley18
5KYTest_KY@gmail.comDanville18
6MITest_MI@gmail.comElko18
7MTTest_MT@gmail.comGallatin17
8NCTest_NC@gmail.comJeffersonville17
9NCTest_NC@gmail.comJohnston17
10NCTest_NC@gmail.comJohnstown17
11NMTest_NM@gmail.comKennewick18
12NMTest_NM@gmail.comLake Havasu City18
13NVTest_NV@gmail.comLas Cruces17
14ORTest_OR@gmail.comLos Alamos17
15PATest_PA@gmail.comMarquette18
16PATest_PA@gmail.comMartinsville18
17TNTest_TN@gmail.comMcMinnville18
18TXTest_TX@gmail.comMissoula18
19VATest_VA@gmail.comOttumwa17
20VATest_VA@gmail.comParis18
21VATest_VA@gmail.comPasco18
22WATest_WA@gmail.comRoxboro17
23WATest_WA@gmail.comSomerset17
24WVTest_WV@gmail.comWarrenton17
25Wilson35
26Grand Total403
Email List
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
One note - the pivot table should be within the email body not as an attachment to the email. thank you!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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