PivotTables


G

Guest

How can you check in VBA code whether a sheet of data has already a pivot
table attached to it (on the same sheet or on a separate sheet)?

Thank you in advance for any help.
 
Ad

Advertisements

D

Debra Dalgleish

You can count the pivot tables, e.g.:

If ActiveSheet.PivotTables.Count Then
MsgBox "There is a pivot table"
Else
MsgBox "There are no pivot tables"
End If
 
G

Guest

Unfortunately, that code only works when you are on the sheet that has a
pivottable on it, but not for tables on sheets separated from the original
data
 
G

Guest

Then either activate the sheet (Worksheets("whatever").Activate), or just use
the sheet's name directly (Worksheets("whatever").PivotTables.Count).

--
* Please click Yes if this was helpful *
Andy Smith
Senior Systems Analyst
Standard and Poor''s, NYC
 
Ad

Advertisements

D

Debra Dalgleish

Is there just one worksheet with data in the workbook? Are you trying to
determine if a pivot table has been created from that data, somewhere in
the same workbook?
 

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

Similar Threads

Pivottable 0
PivotTable 1
PivotTable 1
PivotTable 1
Pivottable 0
PivotTable 2
Pivottable 4
PivotTable 0

Top