PC Review


Reply
Thread Tools Rate Thread

Can't set pivot table object variable

 
 
=?Utf-8?B?SmVmZiBT?=
Guest
Posts: n/a
 
      13th Feb 2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a variable to add fields to a pivot table =?Utf-8?B?R3dlbg==?= Microsoft Excel Programming 0 9th Jul 2007 11:56 PM
Pivot Table with variable # of columns =?Utf-8?B?c2FtbHlvbg==?= Microsoft Excel Programming 1 2nd Apr 2007 09:54 PM
Entering Variable in a Pivot Table =?Utf-8?B?Zmx5ZXIyNw==?= Microsoft Excel Misc 0 13th Mar 2007 03:05 PM
Pivot Table variable range =?Utf-8?B?TGEgRHVyYW5kZQ==?= Microsoft Excel Programming 1 18th Oct 2004 08:42 PM
Re: Pivot Table - Object variable or with block variable not set? George Nicholson Microsoft Excel Programming 1 16th Apr 2004 09:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:55 AM.