Advanced filter refresh after data change

Goog

New Member
Joined
Jul 3, 2002
Messages
11
I have an advanced filter in Excel 2002 (on Windows XP). I want to automatically refresh/reapply the filter when any of the data (aka "List Range") is changed. I've done a lot of searching and experimentation and I just can't find a good solution. Please let me know if you have any thoughts or suggestions.

Thanks,

Marc
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Ok, after a few hours of messing around in VBA and searching the net, I've found a solution. Maybe it will help someone else in my position so I will post about it here:

My advanced filter situation: I have the source data on one tab, the criteria on another, and the extract range on a third tab (I am copying the filter results not filtering in place). I think this is what was making the vba so difficult for me. My file is called "Pipeline 200.xls" and I have created a named range for my source data (called Database), for my filter criteria (called Criteria), and for my extract (called Extract). I am using Excel 2002.

I created a macro called refresh_data that looks like this:

Code:
Sub refresh_data()

    Range("'Pipeline 200.xls'!Database").AdvancedFilter Action:=xlFilterCopy, _
        CriteriaRange:=Range("'Pipeline 200.xls'!Criteria"), CopyToRange:=Range( _
        "'Pipeline 200.xls'!Extract"), Unique:=False

End Sub

And in the tab with my source data (and the named range called Database) I have put the following code (by right clicking the tab and going to "view code"):

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    refresh_data

End Sub

For whatever reason, if I put the macro code directly in the Worksheet_Change function of the worksheet, it gives me errors.

Hope this helps someone else.

Marc
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,428
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top