THANK YOU!!! I've been trying to figure out how to do this for years! No exaggeration. My one goal today was to finally work out how create a macro that inserts a pivot table using variable table sizes. Amazing. Thanks so much. This is a game-changer! :-)
Hi chester. good video. tried using your approach but mine has an error Run TIme error 9 which is Subscript out of Range at dataname = ActiveSheet.ListObjects(1).Name do you know why is this so. thank you
Tried using your approach but mine has an error Run TIme error 9 which is Subscript out of Range at dataname = ActiveSheet.ListObjects(1).Name . Can you please me with the same or anyone else can help me
thank you. worked for me in general, but i have a question how to make the filter work inside the pivot (i have to eliminate all items from dropdown that have 152; in them, and the list might vary) it keeps the original selection only. :(
Nice. If your filesize expanded dramatically due to many pivot tables, you can set a pt option savedata =false. Each pivot table you create, even if it's the same source, saves a copy of the data unless you toggle the savedata option OR use a data model as source. google is your friend.
Thank you chester. I want to add the pivot table to the existing sheet. I have tried to modify your code but it isn't working. My code stips at dataname = ActiveSheet.ListOpbjects(1).Name
I did exactly as you did and I am getting a run time error 1004 - reference not valid Dim dataname As String Dim newsheet As String dataname = ActiveSheet.ListObjects(1).Name Sheets.Add newsheet = ActiveSheet.Name ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ dataname, Version:=6).CreatePivotTable TableDestination:=newsheet & "!R3C1", _ TableName:="PivotTable1", DefaultVersion:=6