I would like a VBA code (or if necessary other solution) that makes a Pivot Table.
But, the data are on different ranges in the same worksheet. For example (see picture 1 below this post) I have 3 groups of data (red, blue and green: this colors are not important, I use it for this example). Every group has 5 fields (Product, Price, Discount, Localization and Units). And every group has 4 rows.
So, I would like a VBA code that makes a new Pivot Table in another sheet (on the same Excel document) as I show on picture 2 (below this post) with all the available fields, as I show with a red square.
This is just an example, so, I would like a flexible code that detect more groups, fields and rows. For example if someday I add another fill called “year” (see picture 3 below this post) I would like that the VBA code detects this new field. Or also if I need to add more groups, like the orange one that I show on picture 3 or even if I add more rows (again see picture 3).
I uploaded 3 excel files
file-picture 1.xlsx (contains the data that I show on picture 1)
file-picture 2.xlsx (contains the Pivot Table that I show on picture 2)
file-picture 3.xlsx (contains the data that I show on picture 3)
Thank you so much!
picture 1-2-3.jpg
Bookmarks