Hi Experts,
I have 2 worksheets which I coded (on each worksheet) to autofilter as per criteria whenever user select from the validation list. However, I don't know why it only works on the first worksheet. The 2nd worksheet only will autofilter when I click elsewhere and then click back the target cell. I tried to trick the macro to select other cell then select back the target cell upon selection made, but it still not working until I physically click the cells. Is there anyway to overcome this, please? Because I need to restrict the user to use only the validation list to filter the data and not meddle with the headers in the table. Been trying to solve this for 2 days already. ;(
Below is the code on the second worksheet:-
Appreciate the experts' help.
Thank you in advance.
I have 2 worksheets which I coded (on each worksheet) to autofilter as per criteria whenever user select from the validation list. However, I don't know why it only works on the first worksheet. The 2nd worksheet only will autofilter when I click elsewhere and then click back the target cell. I tried to trick the macro to select other cell then select back the target cell upon selection made, but it still not working until I physically click the cells. Is there anyway to overcome this, please? Because I need to restrict the user to use only the validation list to filter the data and not meddle with the headers in the table. Been trying to solve this for 2 days already. ;(
Below is the code on the second worksheet:-
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim LastRow As Long
ActiveSheet.Unprotect Password:="abcd1234"
If Target.Address <> "$C$3" Then Exit Sub
If Target.Address = "$C$3" Then
LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
ActiveSheet.Range("A4:AC" & LastRow).AutoFilter Field:=1, Criteria1:=Array(Range("$C$3"), "="), Operator:=xlFilterValues
ActiveSheet.Protect Password:="abcd1234"
End If
End Sub
Appreciate the experts' help.
Thank you in advance.