Create a pivot table from database

mark84

New Member
Joined
Jan 22, 2021
Messages
29
Office Version
  1. 2016
Platform
  1. Windows
Hi everybody,
I have a DB like img1.
I d want to create a VBA code to create a pivot table with the fields in the img2.
The field "Somma di AVG PV" is a Calculated Field obtained from the database fields ratio =Imponibile/Qtaevasa.

Could you help me please?
Thank you!

Regards
Marco
 

Attachments

  • img1.PNG
    img1.PNG
    49.7 KB · Views: 5
  • img2.PNG
    img2.PNG
    6.4 KB · Views: 5

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
click record macro,
create your pivot.
then end macro.

The macro should work as long as you don't have an existing pivot in the workbook.
you may have to increase/decrease row counts before use if the data changes.
 
Upvote 0
Thanks for your answer but I’m looking for a vba code that is different from a recorde macro, that’s not dynamic.

could you help me with a dynamic solution?

thanks
 
Upvote 0

Forum statistics

Threads
1,215,506
Messages
6,125,197
Members
449,214
Latest member
mr_ordinaryboy

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