Hello,
At work, I extract a report in Excel with 35 columns (A-AI) and a variable number of rows. I created an Excel file to analyze this data, so one tab contains the pasted data and several other tables and pivot charts based on them. As not all columns from the report are needed by me, I created a macro that:
- removes duplicates
- removes unnecessary columns
- Updates all pivot tables
Finally, it obtains a table with 17 columns (A to Q) as the basis for the pivot tables. And here I have a problem.
When I create a PivotTable, I have a data range: 'Data to analyze'! $ A $ 1: $ Q $ 229.
Unfortunately, after uploading new data to the tab and running the macro, the scope changes to "Data for analysis"! $ A $ 1: $ G $ 697.
Why does the table data range change (omit HQ columns)?
The macro looks like this:
At work, I extract a report in Excel with 35 columns (A-AI) and a variable number of rows. I created an Excel file to analyze this data, so one tab contains the pasted data and several other tables and pivot charts based on them. As not all columns from the report are needed by me, I created a macro that:
- removes duplicates
- removes unnecessary columns
- Updates all pivot tables
Finally, it obtains a table with 17 columns (A to Q) as the basis for the pivot tables. And here I have a problem.
When I create a PivotTable, I have a data range: 'Data to analyze'! $ A $ 1: $ Q $ 229.
Unfortunately, after uploading new data to the tab and running the macro, the scope changes to "Data for analysis"! $ A $ 1: $ G $ 697.
Why does the table data range change (omit HQ columns)?
The macro looks like this:
Code: VBScript