How to I auto-refresh an Excel auto-filter when data is changed?

Use case: I change the value of one cell to a value that was filtered. I want to see the current row disappearing without having to do anything else.

link|improve this question

39% accept rate
3  
I was able to get it to work when I put that code in the Worksheet_Change() event instead of the Worksheet_Calculate() event. – F106dart Feb 24 '11 at 13:47
1  
put this as an answer and accept it, so that others know what you did and that the question has been resolved. – jzd Feb 24 '11 at 17:26
I had to make another modification because Calculate was expecting a parameter. Now it works!. – Sorin Sbarnea Feb 27 '11 at 15:21
feedback

1 Answer

up vote 0 down vote accepted

Right click on your sheet name, choose view code and paste the code below. This will enable auto-refresh. Do not forget to save the file in a format with macro support lie .xlsm.

Private Sub Worksheet_Change(ByVal Target As Range)

    If Me.FilterMode = True Then
        With Application
           .EnableEvents = False
           .ScreenUpdating = False
        End With

        With ActiveWorkbook
            .CustomViews.Add ViewName:="Mine", RowColSettings:=True
          Me.AutoFilterMode = False
            .CustomViews("Mine").Show
            .CustomViews("Mine").Delete
        End With


         With Application
           .EnableEvents = True
           .ScreenUpdating = True
        End With
    End If

End Sub
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.