I created a code for CheckBox57 that is intended to apply a filter to a specific column (field 15 within the filter range) when selected and remove that same filter when deselected. See below.
The code does not work. Every time I click and unclick the checkbox, no filter is applied. Interestingly, if I invert the false and the true in the code, I get the opposite result. The filter is applied each time.
I attempted changing it to an afterupdate event but that didn't work. I also attempted linking the event to the linked cell instead of the checkbox itself and got the same result.
VBA Code:
Sub CheckBox57_Click()
Select Case CheckBox57
Case True
Dat = Format(Range("AY3").Value, "mm/dd/yyyy")
ActiveSheet.Range("A2:AT2").AutoFilter Field:=15, Criteria1:=">" & Dat
Case False
ActiveSheet.Range("A2:AT2").AutoFilter Field:=15
End Select
End Sub
The code does not work. Every time I click and unclick the checkbox, no filter is applied. Interestingly, if I invert the false and the true in the code, I get the opposite result. The filter is applied each time.
VBA Code:
Sub CheckBox57_Click()
Select Case CheckBox57
Case False
Dat = Format(Range("AY3").Value, "mm/dd/yyyy")
ActiveSheet.Range("A2:AT2").AutoFilter Field:=15, Criteria1:=">" & Dat
Case True
ActiveSheet.Range("A2:AT2").AutoFilter Field:=15
End Select
End Sub
I attempted changing it to an afterupdate event but that didn't work. I also attempted linking the event to the linked cell instead of the checkbox itself and got the same result.
Last edited: