How to populate a Pivot Table using VBA code?

  • Thread starter Thread starter I_need_the_reply_urgently
  • Start date Start date
I

I_need_the_reply_urgently

Hi,

I have a Pivot Table report that I am supposed to populate using the VBA code.
Can somebody please help me in writing the VBA code?

I am new to VBA as well as Pivot Table. So, please try to explain in detail.

Thanks!!
 
Hi,

if you have a Pivot Table you have some basic data in another table usually.
The Pivot Table gives you an overview, a concentration of data or a special
view of the basic data you have somewhere.
So ususally Pivot Tables don't get populated, you populate the basic data
table.

If data is added to the basic data table, or modified you may want to update
your Pivot Table to reflect the modified basic data.

You do this by going to the sheet with the Pivot Table, right click into the
Pivot Table and select "update data" or some similar text (I use german
Excel, so I don't know the exact english words).

If you want to automate this update of the Pivot Table with a macro you can
use the following piece of code:

ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh

You may have to modify "PivotTable1" to the name of your Pivot Table(s).

I hope this is going go get you started.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top