How can I auto refresh a column that has an auto filter in place

P

Pastal

I am workin in Excel, and have an issue with filtering a column
automatically. The column is fed by formulas in the cells. I want to auto
filter the column (non-blanks) and this works fine. However, when the input
data is changed, and the column fills with new values, the filter is not
automatically re-applied, and I have to manually re-apply it. How can I
automize this process?
 
G

Gary''s Student

This example uses data in column A. The macro will automatically refresh the
autofilter whenever formulas are calculated:

Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Set r = ActiveCell
Columns("A:A").Select
Application.CutCopyMode = False
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>"
r.Select
Application.EnableEvents = True
End Sub

Note that this is Event code and goes in the worksheet code area, not a
standard module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top