#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default PivotTables

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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,979
Default PivotTables

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


Gerry Verschuuren wrote:
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.



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default PivotTables

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

"Debra Dalgleish" wrote:

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


Gerry Verschuuren wrote:
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.



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 50
Default PivotTables

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



"Gerry Verschuuren" wrote:

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

"Debra Dalgleish" wrote:

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


Gerry Verschuuren wrote:
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.



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,979
Default PivotTables

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?

Gerry Verschuuren wrote:
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

"Debra Dalgleish" wrote:


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


Gerry Verschuuren wrote:

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.



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html





--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
PivotTables KerryK Excel Discussion (Misc queries) 2 October 8th 07 07:06 PM
Interactive PivotTables on the Web dvbunte Excel Discussion (Misc queries) 1 August 1st 07 06:30 AM
Sorting in pivottables traima Excel Worksheet Functions 5 January 29th 07 03:40 PM
Format Pivottables? Olle Excel Discussion (Misc queries) 1 November 17th 06 08:08 PM
New to Pivottables- need help coal_miner Charts and Charting in Excel 1 June 6th 05 06:48 PM


All times are GMT +1. The time now is 11:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"