Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default pivottable or querytable

I want to determine if the current selection is a pivottable,
querytable or neither. Any ideas here?

Thanks!
Dave

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default pivottable or querytable

You could check the active cell:

Sub CheckPivotAndQuery()
Dim strPivot As String
Dim strQuery As String

On Error Resume Next
strPivot = ActiveCell.PivotTable.Name
strQuery = ActiveCell.QueryTable.Name
On Error GoTo 0

If strPivot = "" And strQuery = "" Then
MsgBox "No pivot table and no query"
Else
If strPivot < "" Then
MsgBox strPivot
Else
MsgBox strQuery
End If
End If

End Sub


Dave wrote:
I want to determine if the current selection is a pivottable,
querytable or neither. Any ideas here?

Thanks!
Dave



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default pivottable or querytable

Exactly what I needed. Thanks Debra!

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
Creating a PivotTable w/o selecting data in an existing PivotTable Damian Excel Discussion (Misc queries) 6 November 2nd 07 04:44 PM
How to use QueryTable with insertion sql ou Excel Programming 1 August 18th 04 12:20 PM
PivotTable - PivotTable Field name is not valid - error! miker1999[_17_] Excel Programming 1 June 10th 04 10:30 AM
Querytable Ben.c Excel Programming 4 December 3rd 03 09:11 AM
MS QUERY w/out querytable No Name Excel Programming 1 October 24th 03 03:55 PM


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

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"