Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default getting information about a pivot table

Hi,

i have several pivot tables; each table shows the same sort of data: eg,
'TVC' which show 'Count of TVC', 'Min of TVC', 'Max of TVC', 'Average of
TVC'. (to explain, the next table would show something like 'Count of
Spores', 'Min of Spores', 'Max of Spores', 'Average of Spores'). i want to
use VBA to re-name these automatically generated names, so: -

'Count of TVC' becomes 'TVC (Total Samples)'
'Min of TVC' becomes 'TVC (Minimum)'
'Max of TVC' becomes 'TVC (Maximum)'
'Average of TVC' becomes 'TVC (Average)'

i want to develop it in vba because it is the sort of thing that i do alot,
but i cannot get the syntax correct to work on the current pivot table, or
to process through each pivot field.

i thought something like this (below) would help, but i can't get any
variation of it to work: -

---
MyValue = InputBox("What Test?")

ActiveSheet.PivotTables().PivotFields(1).Caption = MyValue & " (Samples
Tested)"
ActiveSheet.PivotTables().PivotFields(2).Caption = MyValue & " (Minimum)"
ActiveSheet.PivotTables().PivotFields(3).Caption = MyValue & " (Maximum)"
ActiveSheet.PivotTables().PivotFields(4).Caption = MyValue & " (Average)"

---

if anyone can understand this, please help!

Thanks,

Tim


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default getting information about a pivot table

HI Tim
Try this:
Sub CHGPVTNAMES()
Dim pt As PivotTable

For Each pt In ActiveSheet.PivotTables
pt.DataFields(1).Caption = "YOUR TEXT "
Next pt
End Sub

Mike

"Tim" wrote:

Hi,

i have several pivot tables; each table shows the same sort of data: eg,
'TVC' which show 'Count of TVC', 'Min of TVC', 'Max of TVC', 'Average of
TVC'. (to explain, the next table would show something like 'Count of
Spores', 'Min of Spores', 'Max of Spores', 'Average of Spores'). i want to
use VBA to re-name these automatically generated names, so: -

'Count of TVC' becomes 'TVC (Total Samples)'
'Min of TVC' becomes 'TVC (Minimum)'
'Max of TVC' becomes 'TVC (Maximum)'
'Average of TVC' becomes 'TVC (Average)'

i want to develop it in vba because it is the sort of thing that i do alot,
but i cannot get the syntax correct to work on the current pivot table, or
to process through each pivot field.

i thought something like this (below) would help, but i can't get any
variation of it to work: -

---
MyValue = InputBox("What Test?")

ActiveSheet.PivotTables().PivotFields(1).Caption = MyValue & " (Samples
Tested)"
ActiveSheet.PivotTables().PivotFields(2).Caption = MyValue & " (Minimum)"
ActiveSheet.PivotTables().PivotFields(3).Caption = MyValue & " (Maximum)"
ActiveSheet.PivotTables().PivotFields(4).Caption = MyValue & " (Average)"

---

if anyone can understand this, please help!

Thanks,

Tim



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default getting information about a pivot table

Mike, thanks for that... could you or someone else extend it slightly
further to tell me how to do the same thing on just the pivot table in which
the active cell currently resides (ie, just change that table, not all
tables)... i know this slightly contradicts what i said before, but both
scenarios apply.

thanks,

Tim

"MIKE215" wrote in message
...
HI Tim
Try this:
Sub CHGPVTNAMES()
Dim pt As PivotTable

For Each pt In ActiveSheet.PivotTables
pt.DataFields(1).Caption = "YOUR TEXT "
Next pt
End Sub

Mike

"Tim" wrote:

Hi,

i have several pivot tables; each table shows the same sort of data: eg,
'TVC' which show 'Count of TVC', 'Min of TVC', 'Max of TVC', 'Average

of
TVC'. (to explain, the next table would show something like 'Count of
Spores', 'Min of Spores', 'Max of Spores', 'Average of Spores'). i want

to
use VBA to re-name these automatically generated names, so: -

'Count of TVC' becomes 'TVC (Total Samples)'
'Min of TVC' becomes 'TVC (Minimum)'
'Max of TVC' becomes 'TVC (Maximum)'
'Average of TVC' becomes 'TVC (Average)'

i want to develop it in vba because it is the sort of thing that i do

alot,
but i cannot get the syntax correct to work on the current pivot table,

or
to process through each pivot field.

i thought something like this (below) would help, but i can't get any
variation of it to work: -

---
MyValue = InputBox("What Test?")

ActiveSheet.PivotTables().PivotFields(1).Caption = MyValue & " (Samples
Tested)"
ActiveSheet.PivotTables().PivotFields(2).Caption = MyValue & "

(Minimum)"
ActiveSheet.PivotTables().PivotFields(3).Caption = MyValue & "

(Maximum)"
ActiveSheet.PivotTables().PivotFields(4).Caption = MyValue & "

(Average)"

---

if anyone can understand this, please help!

Thanks,

Tim





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
Information for Pivot Table HL Excel Discussion (Misc queries) 3 June 1st 10 10:11 PM
Pivot table cutting information of a part of the information ASR Excel Discussion (Misc queries) 1 November 5th 09 02:09 PM
Pivot Table moving information RK WV Excel Discussion (Misc queries) 1 August 25th 09 12:02 AM
Using the information from a pivot table Louja Excel Worksheet Functions 3 May 14th 09 11:57 AM
pivot table maybe?? combining information laandmc Excel Discussion (Misc queries) 2 September 8th 08 10:31 AM


All times are GMT +1. The time now is 06:58 AM.

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"