Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Programmatically getting a Max value from a PivotTable

Is it possible to extract the maximum value of a pivot table field
without going to the raw data that the table is based on? .... I assume
that this will include caches: not something I've ever messed around
with.

Any help greatly appreciated
Jason.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Programmatically getting a Max value from a PivotTable

Jason,

Something like this, where you want the max value in the "Total" column:

Sub FindMAX()
Dim myPT As Range
Dim myCell As Range

Set myPT = Range("A3").CurrentRegion
Set myCell = myPT.Find("Total", , , xlWhole)

MsgBox Application.Max(Intersect(myCell.EntireColumn, myPT))

End Sub

But if you need to leave out the Grand Total at the bottom, you would need to do something like

Sub FindMAX()
Dim myPT As Range
Dim myCell As Range

Set myPT = Range("A3").CurrentRegion
Set myPT = myPT.Resize(myPT.Rows.Count - 1)
Set myCell = myPT.Find("Total", , , xlWhole)

MsgBox Application.Max(Intersect(myCell.EntireColumn, myPT))

End Sub


HTH,
Bernie
MS Excel MVP


"WhytheQ" wrote in message
oups.com...
Is it possible to extract the maximum value of a pivot table field
without going to the raw data that the table is based on? .... I assume
that this will include caches: not something I've ever messed around
with.

Any help greatly appreciated
Jason.



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
Creating a PivotTable w/o selecting data in an existing PivotTable Damian Excel Discussion (Misc queries) 6 November 2nd 07 04:44 PM
Programmatically reading data field values from PivotTable Enrico Campidoglio[_2_] Excel Programming 2 July 13th 05 12:32 PM
How does one get the PivotTable report info that feeds another PivotTable report? Toby Erkson[_3_] Excel Programming 0 December 14th 04 10:00 PM
PivotTable - PivotTable Field name is not valid - error! miker1999[_17_] Excel Programming 1 June 10th 04 10:30 AM
Creating a PivotTable Report from an Another PivotTable Report bcpaulus Excel Programming 1 January 8th 04 07:56 PM


All times are GMT +1. The time now is 11:31 PM.

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

About Us

"It's about Microsoft Excel"