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.
 

Some videos you may like

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Watch MrExcel Video

Forum statistics

Threads
1,127,356
Messages
5,624,219
Members
416,017
Latest member
moritz210

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
Top