i cant define sourcedata for vba

Viewed 53

I am trying to create a pivot table using vba. My first step is to create pivotcaches. I dont know what to do with sourcedata. I looked up online, people are using like SourceData:= "Sheet1!R1C1:R4C3". I can not do it because i have to update worksheet everyday and i have thousands of rows and columns. i am thinking to do like ctrl + a (select all the regions) but i dont know what to do and i tried sourcedata:= sheets("nameofmysheet").range("a2"),currentregion. it wont work either. i dont know what to do now. Help me!

1 Answers

Best advice? Record a macro when you create a pivot table and then look at the code generated by Macro This way you can experiment and create various pivots from various sources. It will help you understand the process.

Related