Forum

Simple table filter...
 
Notifications
Clear all

Simple table filter code not working

3 Posts
2 Users
0 Reactions
64 Views
(@lanser)
Posts: 61
Estimable Member
Topic starter
 

Hi,

I use the following code to filter a table based on cell values in field 2 that ="yes", it was working but now it just flickers rapidly as if filtering then unfiltering.

I am sure its something simple but I can't see it

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub

If Not Intersect(Target, Worksheets("ListToFilter").Range("F1")) Is Nothing Then
With ActiveWorkbook.Worksheets("ListToFilter").ListObjects("Table110")
.AutoFilter.ApplyFilter
End With
End If

End Sub

 
Posted : 16/04/2021 11:50 am
(@catalinb)
Posts: 1937
Member Admin
 

Can you provide a sample file where we can replicate the issue?
Hard to say, it may be something related to your sheet setup.

 
Posted : 18/04/2021 9:21 am
(@lanser)
Posts: 61
Estimable Member
Topic starter
 

Turns out that that code snippet only works if the table is already filtered, in this case a column is filtered on ="Yes" if I clear the filter I get the above result.

 

But if I apply the filter then change the value in F1 (which can change the "Yes" column) the table does refilter as expected.

 

regards

John

 
Posted : 23/04/2021 7:30 am
Share: