returning pivottable object from a range object

  • Thread starter Thread starter Grant
  • Start date Start date
G

Grant

Hi there,

Is there anyway to return a pivottable object from a
range object?

Thanks,
Grant.
 
assume rng is the rng object

rng.PivotTable.name

from help:
Returns a PivotTable object that represents the PivotTable containing the
upper-left corner of the specified range. Read-only.

or you can try something along the lines of :

for each pvt in rng.Parent.PivotTables
if not Intersect(rng,pvt.TableRange2) is nothing then
msgbox pvt.Name & " found "
exit for
end if
Next
 
Awesome! Thanks very much.

-----Original Message-----
assume rng is the rng object

rng.PivotTable.name

from help:
Returns a PivotTable object that represents the PivotTable containing the
upper-left corner of the specified range. Read-only.

or you can try something along the lines of :

for each pvt in rng.Parent.PivotTables
if not Intersect(rng,pvt.TableRange2) is nothing then
msgbox pvt.Name & " found "
exit for
end if
Next

--
Regards,
Tom Ogilvy





.
 

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

Back
Top