Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Pivot Table Relative References

Looking for help with VBA code.

I would like to store in a variable the amount of child categories that
are part of a given row or column.

Are pivot table size details referenced in any functions?

My user requires a formula inserted to the bottom of the pivot which
will summarize the above data. This requires knowing the cell
locations to put into these formulas.

Thank you,

JR

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Pivot Table Relative References

If the ActiveCell is in the pivot table, the code below can get the
addresses of the pivot table row and column the cell is in.

Option Explicit

Sub GetPivotTableInfo()

Dim rngDataRange As Range
Dim rngRow As Range
Dim rngColumn As Range

Set rngDataRange = Application.ActiveCell.PivotField.DataRange
Set rngRow = Intersect(Rows(ActiveCell.Row), rngDataRange)
Set rngColumn = Intersect(Columns(ActiveCell.Column), rngDataRange)

MsgBox "Row address: " & rngRow.Address
MsgBox "Column address: " & rngColumn.Address

End Sub


Mark


Jimmy wrote:
Looking for help with VBA code.

I would like to store in a variable the amount of child categories that
are part of a given row or column.

Are pivot table size details referenced in any functions?

My user requires a formula inserted to the bottom of the pivot which
will summarize the above data. This requires knowing the cell
locations to put into these formulas.

Thank you,

JR


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Pivot Table Relative References

Thanks.
It works!


Mark Driscol wrote:
If the ActiveCell is in the pivot table, the code below can get the
addresses of the pivot table row and column the cell is in.

Option Explicit

Sub GetPivotTableInfo()

Dim rngDataRange As Range
Dim rngRow As Range
Dim rngColumn As Range

Set rngDataRange = Application.ActiveCell.PivotField.DataRange
Set rngRow = Intersect(Rows(ActiveCell.Row), rngDataRange)
Set rngColumn = Intersect(Columns(ActiveCell.Column), rngDataRange)

MsgBox "Row address: " & rngRow.Address
MsgBox "Column address: " & rngColumn.Address

End Sub


Mark


Jimmy wrote:
Looking for help with VBA code.

I would like to store in a variable the amount of child categories that
are part of a given row or column.

Are pivot table size details referenced in any functions?

My user requires a formula inserted to the bottom of the pivot which
will summarize the above data. This requires knowing the cell
locations to put into these formulas.

Thank you,

JR


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
Relative Values in Pivot Table James D. Sheehan Excel Discussion (Misc queries) 2 April 26th 08 03:46 PM
Help with converting a block of cells with Absolute and mixed references to relative references Vulcan Excel Worksheet Functions 3 December 13th 07 11:43 PM
Relative growth in pivot table ChadBellan Excel Discussion (Misc queries) 0 May 31st 07 02:00 PM
Copy data from pivot table using relative reference hello Excel Discussion (Misc queries) 5 April 9th 07 04:13 PM
Relative references for condtional formatting within a Pivot Table Matt X Excel Worksheet Functions 0 July 18th 06 07:42 PM


All times are GMT +1. The time now is 05:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"