View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Identifying Pivot Table's Field

Dim pt as PivotTable
for each pt in Activesheet.PivotTables
if Not intersect(pt.TableRange2,activeCell) is Nothing then
msgbox activeCell.Address & " is in " & pt.Name
Exit for
End if
Next

Change ActiveCell to selection, but that would only indicate if there is an
overlap. If you want totally contained

if Union(pt.TableRange2,Selection).Address = pt.TableRange2.Address then

' totally contained.

--
Regards,
Tom Ogilvy

"Juan Sanchez" wrote in message
...
Hi all...

Is there a way (with vba) to find out if the active cell
or active range is part of a Pivot Table, and if so
retreiving the pivot table name?

Regards
Juan Sanchez