I'm using a filter on a sheet in Excel. All I want to do is uncheck "empty cells" in field 1 of my filterrange. I know how to uncheck the "empty cells" but the existing filter (made by user) must stay active.
Code I'm using to get the name of the filterrange:
Dim obj As ListObject
Dim Tabel As String
Dim filter As Boolean
filter = False
For Each obj In ActiveSheet.ListObjects
Tabel = obj.Name
Exit For
Next
Code that I use to uncheck "empty cells" when no filter is applied:
ActiveSheet.ListObjects(Tabel).Range.AutoFilter field:=1, Criteria1:="<>"
What I prefer to get is the actual filter used in field 1, add the criteria:="<>"
do my thing en reapply the filter applied by the user.
Thing I was trying:
Dim ActieveFilters As String
Dim FilterArray()
Dim LaatsteFilter As Long
Dim i As Long
With ActiveSheet.ListObjects(Tabel).AutoFilter.Filters(1)
ReDim FilterArray(1 To .Count)
For f = 1 To .Count
With .Item(f)
If .On Then
FilterArray(f) = Criteria1
End If
End With
Next f
End With