LearningMacros
New Member
- Joined
- Jan 17, 2013
- Messages
- 1
I think I'm almost there, just need to find a way to point the filter at the drop down box. My macro code appears below. The macro works when I use the commented out line which points to the value of cell e2. The problem is, I want it to point at my dropdown box instead. I think I just have the naming convention wrong. When I change the drop down box using the code below, I get Run-time error '424': Object required
Sub DropDown3_Change()
Dim UserChosenPlant As String
'UserChosenPlant = Range("e2").Value
UserChosenPlant = DropDown3.Value
ActiveSheet.PivotTables("PivotTable4").PivotFields("Branch Plant").CurrentPage _
= UserChosenPlant
ActiveSheet.PivotTables("PivotTable5").PivotFields("Branch Plant").CurrentPage _
= UserChosenPlant
ActiveSheet.PivotTables("PivotTable7").PivotFields("Branch Plant").CurrentPage _
= UserChosenPlant
ActiveSheet.PivotTables("PivotTable8").PivotFields("Branch Plant").CurrentPage _
= UserChosenPlant
End Sub
Dim UserChosenPlant As String
'UserChosenPlant = Range("e2").Value
UserChosenPlant = DropDown3.Value
ActiveSheet.PivotTables("PivotTable4").PivotFields("Branch Plant").CurrentPage _
= UserChosenPlant
ActiveSheet.PivotTables("PivotTable5").PivotFields("Branch Plant").CurrentPage _
= UserChosenPlant
ActiveSheet.PivotTables("PivotTable7").PivotFields("Branch Plant").CurrentPage _
= UserChosenPlant
ActiveSheet.PivotTables("PivotTable8").PivotFields("Branch Plant").CurrentPage _
= UserChosenPlant
End Sub