Это мой код Excel в VBA для автоматического фильтра, но он не работает
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
mr = 1
mc = ActiveCell.Column
getvalue = ActiveSheet.Cells(mr, mc)
my_sheet = ActiveSheet.Name
If Len(Trim(getvalue)) = 0 Then
If ActiveWorkbook.ActiveSheet.FilterMode Or
ActiveWorkbook.ActiveSheet.AutoFilterMode Then
Selection.AutoFilter
End If
'Worksheets(my_sheet).AutoFilterMode = False
Else
If Worksheets(my_sheet).AutoFilterMode = True Then
Worksheets(my_sheet).AutoFilterMode = False
End If
Worksheets(my_sheet).Range("A2").AutoFilter Field:=mc, _
Criteria1:="*" & getvalue & "*", Operator:=xlFilterValues
End If
End Sub