Minx_Minxy
New Member
- Joined
- Jul 13, 2015
- Messages
- 37
- Office Version
- 365
- Platform
- Windows
Hello my fellow Vba coders
My worksheet contains a table where I want it filtered based on two separate dropdown list. The user will first filter cell B3 where the table filters the data accordingly, and then if they choose to, by selecting a value on cell B6, the table filters the information further based on the two values the user has selected.
However, when I run the code the table gets filtered in a way that no value shows up. Also, could there be a way that if the user selects another value on cell B3, the table resets itself, meaning, it un-filters what is currently there and start again. Below is the code I am working with
My worksheet contains a table where I want it filtered based on two separate dropdown list. The user will first filter cell B3 where the table filters the data accordingly, and then if they choose to, by selecting a value on cell B6, the table filters the information further based on the two values the user has selected.
However, when I run the code the table gets filtered in a way that no value shows up. Also, could there be a way that if the user selects another value on cell B3, the table resets itself, meaning, it un-filters what is currently there and start again. Below is the code I am working with
VBA Code:
Private Sub Worksheet_ChangeDepot(ByVal Target As Range)
If Target.Address = "$B$3" Or Target.Address = "$B$6" Then
Sheets("Dashboard").ListObjects("EmployeeHistory").Range.AutoFilter Field:=3, Criteria1:=Range("B3").Value
Sheets("Dashboard").ListObjects("EmployeeHistory").Range.AutoFilter Field:=2, Criteria1:=Range("B6").Value
End If
End Sub