Hi
I have code to update pivot tables based on a cell value. The user selects a filter on a 'Dashboard' tab via ranges plstMonths and plstDepts and a dropdown selection resulting in selYear. The choices are copied to a cell on my 'Calculations' tab via:
Macro 'updatePivot' updates the filter pivots with the results in valYear, selMonth and selDept
Here's my problem: everything works fine, except for the (All) selection on selDept. When (All) is selected as the department, the table fails to update. Refreshing the table manually reverts the filter to the first available selection in the filter options (in this case Engineering). I am able to manually select the (All) filter and selection of individual departments works fine, just not for (All) departments.
The (All) selection appears to be working for selMonth, just not selDept.
It's driving me crazy. Any ideas?
Thanks in advance
I have code to update pivot tables based on a cell value. The user selects a filter on a 'Dashboard' tab via ranges plstMonths and plstDepts and a dropdown selection resulting in selYear. The choices are copied to a cell on my 'Calculations' tab via:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(ActiveCell, [plstMonths]) Is Nothing Then
[selMonth] = ActiveCell.Value
Call updatePivot
ElseIf Not Application.Intersect(ActiveCell, [plstDepts]) Is Nothing Then
[selDept] = ActiveCell.Value
Call updatePivot
End If
End Sub
Macro 'updatePivot' updates the filter pivots with the results in valYear, selMonth and selDept
Code:
Sub updatePivot()
'refresh pivot tables
ThisWorkbook.RefreshAll
'Update filters
[fltCALateOYear] = [valYear]
[fltEquipOYear] = [valYear]
[fltERLateOYear] = [valYear]
[fltProductOYear] = [valYear]
[fltRCAOYear] = [valYear]
[fltRoomOYear] = [valYear]
[fltUtilOYear] = [valYear]
[fltEquipOYear] = [valYear]
[fltCALateOMonth] = [selMonth]
[fltEquipOMonth] = [selMonth]
[fltERLateOMonth] = [selMonth]
[fltProductOMonth] = [selMonth]
[fltRCAOMonth] = [selMonth]
[fltRoomOMonth] = [selMonth]
[fltUtilOMonth] = [selMonth]
[fltEquipOMonth] = [selMonth]
[fltCALateDept] = [selDept]
[fltEquipDept] = [selDept]
[fltERLateDept] = [selDept]
[fltProductDept] = [selDept]
[fltRCADept] = [selDept]
[fltRoomDept] = [selDept]
[fltUtilDept] = [selDept]
[fltEquipDept] = [selDept]
End Sub
Here's my problem: everything works fine, except for the (All) selection on selDept. When (All) is selected as the department, the table fails to update. Refreshing the table manually reverts the filter to the first available selection in the filter options (in this case Engineering). I am able to manually select the (All) filter and selection of individual departments works fine, just not for (All) departments.
The (All) selection appears to be working for selMonth, just not selDept.
It's driving me crazy. Any ideas?
Thanks in advance