Pivot Table IF Statement to Run Specific Macro

jmr9642

New Member
Joined
Jun 18, 2020
Messages
12
Office Version
  1. 2016
Platform
  1. Windows
I am looking to write a macro that will set up my pivot table with specific rows, columns and filters(This part I have). Then, if the pivot table contains a Priority section, I want to run one macro, and if it doesn't I want to run a different macro (let's call them macro1 and macro2). The priority data can either be there or not be there each time the macro needs to be run based on the data that week.

But then the tricky part is once I have the data I need from whatever macro is run, I need to take that data and calculate the trend when compared to what was found for last week's data. However, last week's data may or may not contain a priority section as well.

This has been giving my code some issues as currently I have been using range lookups due to my misconception that the positions would not change. Due to the fact the data position might change between weeks, I am not sure as to the ideal approach to handle this type of situation.

Thank you for your time in advance, I look forward to your replies.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,214,923
Messages
6,122,289
Members
449,077
Latest member
Rkmenon

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