excel pivot change value of column label
Hi
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
'wsSheet2.Activate
'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
|