Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi !!! I have a very big problem !!! every month i have to refresh my pivot (Pivot_C_1) deleting th previous month & adding a new month (the number of months are always since the current month). The pivot get the data from an Access database and i have group month by quarter & year using cubefields. The data start from december 2003 to december 2005 every month i register the operation with a new manual macro but now want to grow-up and so i need a hand to automate this operation with new parametric macro but, aaargh !!! really i don't understand how have to modify the code. I would like to put in a xl sheet which year,quarter & month (a rang with 3 columns for 7 rows/months) & then i want to pass these values t a vba macro that change the pivot. Can anybody help me ? Thank you in advance ![]() Sub Change_Month() ActiveSheet.PivotTables("Pivot_C_1").CubeFields(3) .TreeviewControl.Drille = _ Array(Array("", "", ""), Array("[Data].[All Data].[2004]", _ "[Data].[All Data].[2005]", ""), Array("[Data].[Al Data].[2004].[Quarter 4]", _ "[Data].[All Data].[2005].[Quarter 1]", "[Data].[Al Data].[2005].[Quarter 2]")) ActiveSheet.PivotTables("Pivot_C_1").PivotFields("[Data].[Year]") _ HiddenItemsList = Array("[Data].[All Data].[2002]" "[Data].[All Data].[2003]") ActiveSheet.PivotTables("Pivot_C_1").PivotFields("[Data].[Quarter]") _ HiddenItemsList = Array("[Data].[All Data].[2003].[Quarter 2]" _ "[Data].[All Data].[2003].[Quarter 1]", "[Data].[Al Data].[2003].[Quarter 3]", _ "[Data].[All Data].[2004].[Quarter 1]", "[Data].[Al Data].[2005].[Quarter 3]", _ "[Data].[All Data].[2005].[Quarter 4]", "[Data].[Al Data].[2004].[Quarter 2]", _ "[Data].[All Data].[2004].[Quarter 3]") ActiveSheet.PivotTables("Pivot_C_1").PivotFields("[Data].[Month]") _ HiddenItemsList = Array("[Data].[All Data].[2003].[Quarte 3].[July]", _ "[Data].[All Data].[2003].[Quarter 3].[August]", _ "[Data].[All Data].[2003].[Quarter 4].[October]", _ "[Data].[All Data].[2003].[Quarter 4].[November]", _ "[Data].[All Data].[2004].[Quarter 1].[January]", _ "[Data].[All Data].[2004].[Quarter 1].[February]", _ "[Data].[All Data].[2004].[Quarter 2].[April]", _ "[Data].[All Data].[2004].[Quarter 2].[May]", _ "[Data].[All Data].[2004].[Quarter 3].[July]", _ "[Data].[All Data].[2005].[Quarter 2].[June]", _ "[Data].[All Data].[2004].[Quarter 3].[August]") End Sub ![]() ![]() -- Superciu ----------------------------------------------------------------------- Superciuk's Profile: http://www.excelforum.com/member.php...fo&userid=1502 View this thread: http://www.excelforum.com/showthread.php?threadid=26647 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't change Pivot Table data source | Excel Worksheet Functions | |||
can i change pivot table to change data | Excel Discussion (Misc queries) | |||
Non parametric tests | Excel Discussion (Misc queries) | |||
How do you graph parametric equations in Excel? | Excel Discussion (Misc queries) | |||
Change Data In Pivot Table | New Users to Excel |