SOLVED

Refresh filte when opening worksheet

Contributor

Hi,

 

I have a table automaticly updates when I add something on another worksheet.

 

The automatic generated list has a filter on it, to hide the empty cells. Can I make a macro (private sub?) that automaticly refreshes the filter when I open that worsheet?

 

Because I do not change anything manually this code doesn't work

 

Private Sub Worksheet_Change(ByVal Target As Range)
   Sheets("Sheet3").AutoFilter.ApplyFilter
End Sub

 

Can I use a code that runs by opening?

 

1 Reply
best response confirmed by Celia9 (Contributor)
Solution

@Celia9 

I'd use two event procedures. In the ThisWorkbook module:

Private Sub Workbook_Open()
   Sheets("Sheet3").AutoFilter.ApplyFilter
End Sub

and in the worksheet module of Sheet3:

Private Sub Worksheet_Activate()
   Me.AutoFilter.ApplyFilter
End Sub