VBA code to change PivotTable selections, based on ActiveX CheckBoxes on a worksheet.

BasicElement

New Member
Joined
May 25, 2009
Messages
4
Hi everyone !<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p> </o:p>
I really need your help on this one and would really appreciate any suggestions you may have for me !<o:p></o:p>
<o:p> </o:p>
The thing is that I have an Excel Workbook with Raw Data, a big PivotTable, based on it and finally a few nice looking Graphs.<o:p></o:p>
<o:p> </o:p>
I have a "Selection" sheet, with ActiveX CheckBoxes for each week of the year. I want to be able to change the PivotTable selections, based on the selected CheckBoxes.<o:p></o:p>
<o:p> </o:p>
For example:<o:p></o:p>
If a user selects 3 CheckBoxes ("w1", "w5" and "w10"), there should be a macro, assigned to a button, which changes the "Week" selection in PivotTable1.<o:p></o:p>
<o:p> </o:p>
I hope you can help me solve this one and thank you in advance for your time !<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
Best regards,<o:p></o:p>
Victor<o:p></o:p>
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
[resolved]

Hi,
this is just to inform you that the case has been resolved, using the Click events of the Check Boxes, calling another Sub to change the pivot selections.
It looks like this:
---------------------------------------------------------------------
Private Sub CheckBox1_Click()
Call ChangePivottable(Me.CheckBox1.Caption, Me.CheckBox1.Value)
End Sub
---------------------------------------------------------------------
Sub ChangePivottable(ByVal strControlName As String, ByVal bOption As Boolean)
Sheets("RC Overview").PivotTables("PivotTable1").PivotFields("Week").PivotItems(strControlName).Visible = bOption
End Sub
---------------------------------------------------------------------
In this case the Caption of each CheckBox should be exactly the same as the value in the pivot selection.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top