ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA: Group Pivot Table and Combo Box (https://www.excelbanter.com/excel-programming/349608-vba-group-pivot-table-combo-box.html)

THE_RAMONES[_2_]

VBA: Group Pivot Table and Combo Box
 
I have a pivot table that I would like to create a form or combo box that
will give the end user the option of picking different groups. Such as Days,
WTD, MTD, Quarters, YTD. If anyone could get me started I would appreciated.
The code I'm using below is what I have but it continues to give me an
error. Thanks for the help


Private Sub ComboBox1_Change()
Sheets("DAILY").PivotTables("Weekly").PivotFields( "DATE").CurrentPage = _
Sheets("DAILY").Range("AI1").Value

PivotTables("Weekly").PivotFields("DATE").Group Start:=True, End:=True,
Periods:=Array(False, False, False, _
False, True, False, False)

PivotTables("Weekly").PivotFields("DATE").Group Start:=True, End:=True,
Periods:=Array(False, False, False, _
False, False, True, False)

PivotTables("Weekly").PivotFields("DATE").Group Start:=True, End:=True,
Periods:=Array(False, False, False, _
False, True, True, False)

PivotTables("Weekly").PivotFields("DATE").Group Start:=True, End:=True,
Periods:=Array(False, False, False, _
False, False, True, True)

End Sub



All times are GMT +1. The time now is 10:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com