schielrn
Well-known Member
- Joined
- Apr 4, 2007
- Messages
- 6,941
Below is my code that changes my "cover" sheet based on a filter in the "detail" sheet. My "cover" sheet uses subtotals and has a combo box on there to select different regions. I would like to get rid of the .selects, but I can't figure out how to use With sheets("detail") to get rid of them.
Any help would be appreciated. Thanks.
Any help would be appreciated. Thanks.
Code:
Sub DropDown2_Change()
Application.ScreenUpdating = False
If (Range("C15").Value = 2) Then
Sheets("detail").Select
Selection.AutoFilter Field:=1, Criteria1:="North Central"
Sheets("cover").Select
ElseIf (Range("C15").Value = 1) Then
Sheets("detail").Select
Selection.AutoFilter Field:=1, Criteria1:="West"
Sheets("cover").Select
ElseIf (Range("C15").Value = 3) Then
Sheets("detail").Select
Selection.AutoFilter Field:=1, Criteria1:="South Central"
Sheets("cover").Select
ElseIf (Range("C15").Value = 4) Then
Sheets("detail").Select
Selection.AutoFilter Field:=1, Criteria1:="HDQ"
Sheets("cover").Select
ElseIf (Range("C15").Value = 5) Then
Sheets("detail").Select
Selection.AutoFilter Field:=1
Sheets("cover").Select
End If
Application.ScreenUpdating = True
End Sub