从同一列中的活动自动filter中删除当前单元格的值

我有一个大的Excel工作表,包含+ 100k行,并在一列文本值与类别号码和说明自动filter。 F列中有数千个不同的值,所以使用标准UI更新自动filter是非常不切实际的。

我如何创build一个macros,从同一列上激活的自动filter中删除当前活动单元格的值?

在专家的帮助下,我们为我的案子find了一个可行的解决scheme。
只要发布这个解决scheme为他人:

Sub Clear_Filter_and_Value() Application.ScreenUpdating = False Application.DisplayAlerts = False Dim w As Worksheet Dim filterArray() Dim currentFiltRange As String Dim col As Integer Dim flag As Boolean Set w = ActiveSheet If w.AutoFilterMode = False Then Selection.AutoFilter flag = False On Error GoTo exit1 With w.AutoFilter currentFiltRange = .Range.Address With .Filters For f = 1 To .Count With .Item(f) If .On Then If ActiveCell.Column = f Then ReDim filterArray(1 To .Count) If .Count = 2 Then filterArray(1) = .Criteria1 filterArray(2) = .Criteria2 Else filterArray(1) = .Criteria1 End If End If ElseIf ActiveCell.Column = f Then tR = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row ReDim filterArray(1 To tR - 1) For i = 2 To tR filterArray(i - 1) = Cells(i, ActiveCell.Column).Value flag = True Next i End If End With Next f End With End With w.AutoFilterMode = False j = 1 ReDim newArray(1 To UBound(filterArray)) If flag = False Then On Error GoTo 1 For i = 1 To UBound(filterArray(1)) On Error GoTo 1 If InStr(1, filterArray(1)(i), ActiveCell.Value) = 0 Then newArray(j) = filterArray(1)(i) j = j + 1 End If Next i Else 1: Err.Clear For i = 1 To UBound(filterArray) If InStr(1, filterArray(i), ActiveCell.Value) = 0 Then newArray(j) = filterArray(i) j = j + 1 End If Next i End If For col = 1 To 1 If Not IsEmpty(filterArray(1)) Then w.Range(currentFiltRange).AutoFilter Field:=ActiveCell.Column, Criteria1:=newArray, Operator:=xlFilterValues End If Next col exit1: Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub