View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Debra Dalgleish Debra Dalgleish is offline
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