How to update advanced filter result automatically in Excel?
When we apply the Advanced Filter feature, we will find that the filtered result will not change automatically with the criteria change. This needs us to apply the Advanced Filter function once again to get the new result. But, do you have any good and quick trick for updating the advanced filter result automatically as following screenshot shown in Excel?
The following VBA code may help you to automatically update the advanced filter result when you change the criteria as you need, please do as this:
1. Right click the sheet tab that you want to filter the data automatically, and then choose View Code from the context menu, in the opened Microsoft Visual Basic for applications window, copy and paste the following code into the blank Module:
VBA code: Update advanced filter result automatically:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Range("A5:D21").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range _ ("A1:C3"), Unique:=False End Sub
Note: In the above code: A5:D21 is the data range which you want to filter, A1:C3 is the criteria range to filter based on.
2. Then save and close the code window, now, when you change the criteria in the criteria range, the filtered result will be updated automatically at once.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!