![]() |
Can't set pivot table object variable
Hello All,
I have a simple workbook with two worksheets that I named in the IDE as wksImportedData and wksPivot, which hold an external data QueryTable and a Pivot Table respectively. I wrote a procedure to make it easy for my client to "reset" the pivot table to its default configuration, in case they get carried away dragging fields all over creation (and who doesn't, with pivot tables?). The problem is that my object variable doesn't seem to get assigned to the pivot table like it should. Here is the code: dim pvtFinancials as Excel.PivotTable set pvtFinancials = wksPivot.PivotTables("pvtAcctFinancials") When I use pvtFinancials in the code, however, I get a 1004 error. As a sanity check, I typed the following into the Immediate Window: ?wksPivot.PivotTables.Count and got a 1. Encouraged, I typed: ?wksPivot.PivotTables(1).Name and got a 1004 error. Does anyone have any ideas as to what might be going on? All help and advice are greatly appreciated, - jeff |
All times are GMT +1. The time now is 12:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com