VBA - PIVOT table data transfer to new worksheet

marioh

New Member
Joined
Apr 28, 2020
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello I wondered if you could help. I have just started to learn how to use VBA to help with data management in excel. I'm using excel office 365 on windows 10.

I managed to create a macro that processes the raw data into a pivot table filtered to a set format (lets call this sheet 1). Within sheet 1 on the pivot table from A7 (excluding the header) there is a list of unique IDs and numerous associated rows of information (the number of rows and columns will always vary). On another worksheet (lets call this sheet 2) I have another list of reference IDs from A2 to A90 (excluding the header), the range is fixed. The problem i have is i only want the rows of information associated with the unique IDs listed on sheet 2 which match the unique IDs listed on sheet 1 of the Pivot table. To simplify, I need to extract the rows of data on sheet 1 from the pivot table, where the unique IDs match the IDs on sheet 2. If a reference ID on sheet 2 does not match any unique ID on sheet 1 then that row on sheet two should be left blank. The process would continue until excel has gone through the entire list of reference IDs on sheet 2 and extracted the rows from the pivot table on sheet 1, whenever a match has been found. The order the reference IDs are placed in sheet 2 is important, as the order is set.

I've attached some snapshots to hopefully help with explaining things a bit better.

I would be incredibly grateful in getting your help with a VBA code that can achieve this goal.

Mario

Example.png
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,223,893
Messages
6,175,248
Members
452,623
Latest member
cliftonhandyman

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