LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Pivot Table Programming

Hi,

I have a pivot table and I'm tryng to change the page data dynamically. The
page data is a period dimension and based on the quarter, and month, it
should filter the page area...here is my code below and I will explain where
the
problem is below...

This is a custom function that gets the quarter...nothing wrong here
Function QTRNum(ENTER_DATE)
QTRNum = DatePart("q", ENTER_DATE)
End Function
-----------------------------------------------------------
This is the function that does the work.

Function currMonth()
'Declare some stuff
Dim D As String
Dim Y As String
Dim m As String
Dim Q As String

'Set values. I'm palcing the format of the data for the for the page field

Q = "[Quarter " & Module5.QTRNum(Date) & "]"
Y = "[" & Year(Date) & "]"
m = "[" & MonthName(Month(Date)) & "]"

'This simply assigns the .addpageitem to the currMonth variable. I know the
value is correct, because I will debug.pring CurrMonth and then paste the
results in the procedure and it executes fine. It's like it won't take a
string for this method.

It produces this...AddPageItem "[PERIOD].[All PERIOD].[2004].[Quarter
3].[October]"

currMonth = ".AddPageItem " & Chr(34) & "[PERIOD].[All PERIOD]" & "." & Y &
"." & Q & "." & m & Chr(34)
End Function
---Now, this is what should set the filter

With ActiveSheet.PivotTables("YTD").PivotFields("[PERIOD]")
.AddPageItem "[PERIOD].[All PERIOD].[2004].[Quarter 1]", True
.AddPageItem "[PERIOD].[All PERIOD].[2004].[Quarter 2]"
.AddPageItem "[PERIOD].[All PERIOD].[2004].[Quarter 3]"
Module5.currMonth
End With

HELP PLEASE!!!!!!!!!!!!



Expand AllCollapse All

Manage Your Profile


 
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
how to create pivot table from existing pivot table in excel 2007 Udayraj Dhulekar Excel Discussion (Misc queries) 2 July 8th 13 08:22 PM
Excel Food Price Table, Programming, Is This Table All Right? Davi Excel Discussion (Misc queries) 2 June 3rd 07 12:24 PM
Pivot table Programming Kris Excel Programming 1 October 5th 04 09:03 PM
VBA Programming with Pivot Tables no1uknow Excel Programming 1 September 23rd 03 12:52 AM
Help required with setting up a pivot table with the source on sheet1 to have the pivot table created on sheet called "report" Diana[_5_] Excel Programming 0 August 21st 03 10:19 PM


All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"