Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
problem with macro for pivot tables
Hi All,
Im trying to write a macro that makes a period visible in a number of Pivottables (all in one workbook). The period is mentioned in the cell with the name period. I have come up with the macro mentioned below, but it does not work with the 'bPeriodNew' in the following line: PT.PivotFields("period").PivotItem(bPeriodNew).Vis ible = True However, when I change 'bPeriodNew' to, for example, '"2"' in this line, it works perfectly well. I checked the value of the line: bPeriodNew = Range("period").Value in my direct screen and it gives a correct value. Yet the macro does not work. Any idea what I am doing wrong? Kind regards, Hans Sub ChangePeriodPivot Dim bPeriodNew As Byte Dim PT As PivotTable Dim Sh1 As Sheets Dim wk As Worksheet bPeriodNew = Range("period").Value Set sh1 = Worksheets(Array[number of sheets]) For Each wk In Sh1 For Each PT In wk.PivotTables PT.PivotFields("period").PivotItem(bPeriodNew).Vis ible = True Next PT Next wk End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problem with pivot tables | Excel Worksheet Functions | |||
Pivot tables problem | Excel Discussion (Misc queries) | |||
Localisation problem with pivot tables | Setting up and Configuration of Excel | |||
Pivot tables, stupid problem | Excel Discussion (Misc queries) | |||
Please help: Pivot Tables problem | Excel Discussion (Misc queries) |