Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 15th, 2011, 09:57 AM
Registered User
Join Date: Dec 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default excel pivot change value of column label

I am a newbie to excel vba..i have used access vba for quite a while
i have a pivot table on sheet1 that was created from access database.
Now on sheet2 i want to create a report using data from sheet1
so far i can pull data from various cells and change the report filter from
"2011-01" to "2011-02"..Now I want to change the lablel value..
I have tried the following but does not work

Thanks a bunch in advance

'Set up the data fields
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Top Level Budget Group")
.PivotItems ("External IT Labor")
End With
My column lablel is Top Level Budget Group and i want to change the value to External IT Labor

this is my code to date

Set pt = Sheets(1).PivotTables("PivotTable1")
Dim wbBook As Workbook
Dim wsSheet1 As Worksheet
Dim wsSheet2 As Worksheet
Set wbBook = ThisWorkbook
Set wsSheet1 = wbBook.Worksheets("Sheet1")
Set wsSheet2 = wbBook.Worksheets("Sheet2")

With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Fiscal Period")
.PivotItems(Sheets("Sheet1").TextBox1.Value).Visib le = True
.PivotItems(Sheets("Sheet1").TextBox2.Value).Visib le = False
End With

MsgBox wsSheet1.Cells(26, 2).Value
wsSheet2.Cells(6, 3).Value = wsSheet1.Cells(26, 2).Value

'Set up the data fields
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Top Level Budget Group")
.PivotItems ("External IT Labor")
End With
MsgBox wsSheet1.Cells(26, 2).Value
wsSheet2.Cells(7, 3).Value = wsSheet1.Cells(26, 2).Value

Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax for SQL with Date as Column Label? rgi BOOK: Excel 2003 VBA Programmer's Reference 1 September 14th, 2010 03:01 AM
how to change pivot tables column label rhawk204 Excel VBA 0 December 23rd, 2009 10:26 AM
Multiple column Pivot MonkeyMan666 SQL Server 2005 2 August 20th, 2009 07:05 AM
Excel VB : How to change Label Caption papanchal Excel VBA 1 September 22nd, 2008 04:46 PM
Selected column name in Pivot Table harmony82 Access 0 July 25th, 2005 04:25 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.