Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Dates in Pivot Tables

Hi clever people. I am currently doing a project where I am using VB to
produce pivot tables and charts for the end user via macro buttons etc, so
that they don't have to manipulate the pivot tables for themselves (some
people find them confusing!). Ideally what I would like to do is allow users
to input a "From" and "To" date before the macro is run, so as to only return
the data into the pivot that they want to see based on the time periods.
Does anybody know if this is possible. I have tried the "grouping" option
but that seems to be a bit hit and miss and doesn't seem to work with this
set of data I am using.

Any pointers in the right direction gratefully received!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Dates in Pivot Tables

Zani,

Try something like this.

Sub DataRange()

fromdate = InputBox("from")
todate = InputBox("to")

cnt =
Activesheet.PivotTables("PivotTable1").PivotFields ("DATE").PivotItems.Count

For i = 1 to cnt
With Activesheet.PivotTables("PivotTable1").PivotFields ("DATE")
CHK = .PivotItems(i).value
Select Case CHK
Case fromdate To todate
.PivotItems(i).Visible = True
Case Else
.PivotItems(i).Visible = False
End Select
End With
Next i
End Sub

Regards,
Mike
"Zani" wrote:

Hi clever people. I am currently doing a project where I am using VB to
produce pivot tables and charts for the end user via macro buttons etc, so
that they don't have to manipulate the pivot tables for themselves (some
people find them confusing!). Ideally what I would like to do is allow users
to input a "From" and "To" date before the macro is run, so as to only return
the data into the pivot that they want to see based on the time periods.
Does anybody know if this is possible. I have tried the "grouping" option
but that seems to be a bit hit and miss and doesn't seem to work with this
set of data I am using.

Any pointers in the right direction gratefully received!


Reply
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
Dates And Pivot Tables Mike Excel Worksheet Functions 1 July 30th 08 08:55 PM
Pivot tables and dates Sue Excel Worksheet Functions 3 August 24th 07 01:08 AM
Grouping DAtes in Pivot Tables berby65 Excel Discussion (Misc queries) 4 December 1st 06 11:52 PM
Using dates as data in Pivot Tables Jill1 Excel Worksheet Functions 8 November 17th 06 12:22 AM
Grouping Dates in Pivot tables Andy M Excel Discussion (Misc queries) 8 March 26th 05 05:01 PM


All times are GMT +1. The time now is 12:02 AM.

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"