ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   returning pivottable object from a range object (https://www.excelbanter.com/excel-programming/311517-returning-pivottable-object-range-object.html)

grant

returning pivottable object from a range object
 
Hi there,

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

Thanks,
Grant.

Tom Ogilvy

returning pivottable object from a range object
 
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


"Grant" wrote in message
...
Hi there,

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

Thanks,
Grant.




grant

returning pivottable object from a range object
 
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


"Grant" wrote in

message
...
Hi there,

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

Thanks,
Grant.



.



All times are GMT +1. The time now is 01:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com