SOLVED

How to get Excel to automatically re-apply a filter when my table changes?

%3CLINGO-SUB%20id%3D%22lingo-sub-1887546%22%20slang%3D%22en-US%22%3EHow%20to%20get%20Excel%20to%20automatically%20re-apply%20a%20filter%20when%20my%20table%20changes%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1887546%22%20slang%3D%22en-US%22%3E%3CP%3EI%20filter%20the%20rows%20that%20are%20greater%20than%201%25%20in%20the%20INFECTIOUS%20column.%26nbsp%3B%20However%2C%20this%20filter%20is%20not%20reapplied%20when%20my%20data%20changes.%26nbsp%3B%20How%20can%20I%20get%20it%20to%20reapply%20the%20filter%20automatically%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1887546%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1887999%22%20slang%3D%22de-DE%22%3ESubject%3A%20How%20to%20get%20Excel%20to%20automatically%20re-apply%20a%20filter%20when%20my%20table%20changes%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1887999%22%20slang%3D%22de-DE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F869126%22%20target%3D%22_blank%22%3E%40Ian_Heath%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWith%20your%20permission%2C%20if%20I%20can%20recommend.%20It%20can%20help%20us%20all%20if%20you%20upload%20an%20Excel%20file%20(without%20sensitive%20data)%2C%20no%20picture.%3C%2FP%3E%3CP%3EKnowledge%20of%20Excel%20version%20and%20the%20operating%20system%20is%20a%20must%20have%20if%20you%20want%20to%20proposing%20a%20reasonable%20solution%20(Example%3A%20office%20version%20e.g.%202016%20or%202019%20or%20365%20web%20or%20365%20pro%2C%20etc.%20and%20your%20operating%20system%20(e.g.%20Win10%20(2004)%2C%20Win%2010%20(1903)%2C%20Mac%2C%20etc.).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22VIiyi%22%3E%3CSPAN%20class%3D%22JLqJ4b%20ChMk0b%22%3E%3CSPAN%3ENevertheless%2C%20here%20is%20some%20general%20information%20about%20it.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3EReapply%20a%20filter%20and%20sort%2C%20or%20clear%20a%20filter%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Foffice%2Freapply-a-filter-and-sort-or-clear-a-filter-a46f7534-ce5c-4e20-ac9b-e35eec1c48c0%3Fui%3Den-us%26amp%3Brs%3Den-us%26amp%3Bad%3Dus%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Foffice%2Freapply-a-filter-and-sort-or-clear-a-filter-a46f7534-ce5c-4e20-ac9b-e35eec1c48c0%3Fui%3Den-us%26amp%3Brs%3Den-us%26amp%3Bad%3Dus%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20understanding%20and%20patience%3C%2FP%3E%3CP%3EHope%20I%20was%20able%20to%20help%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E*%20Kindly%20Mark%20and%20Vote%20this%20reply%20if%20it%20helps%20please%2C%20as%20it%20will%20be%20beneficial%20to%20more%20community%20members%20reading%20here%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1888104%22%20slang%3D%22en-US%22%3EBetreff%3A%20How%20to%20get%20Excel%20to%20automatically%20re-apply%20a%20filter%20when%20my%20table%20changes%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1888104%22%20slang%3D%22en-US%22%3EThanks%20for%20the%20reference%20Nikolino.%20That%20helped%20me%20to%20discover%20that%20Ctl-Alt-L%20reapplies%20the%20filter.%20Which%20is%20an%20improvement.%20However%2C%20Ctl-Alt-L%20needs%20to%20applied%20on%20the%20Worksheet%20which%20contains%20the%20filter%2C%20whereas%20I%20need%20to%20do%20this%20on%20another%20Worksheet%20that%20contains%20the%20Chart%20affected%20by%20the%20parameters%20I%20change%20there.%20In%20addition%2C%20this%20is%20meant%20for%20use%20by%20the%20general%20scientific%20community%20without%20instruction%20to%20apply%20such%20tricks.%20What%20I%20really%20need%20is%20the%20filter%20to%20be%20reapplied%20automatically%20when%20the%20users%20change%20the%20parameters%20that%20change%20the%20filtered%20data.%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20there%20any%20way%20of%20reapplying%20a%20filter%20automatically%3F%3CBR%20%2F%3E%3CBR%20%2F%3EIan%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1888328%22%20slang%3D%22de-DE%22%3ESubject%3A%20How%20to%20get%20Excel%20to%20automatically%20re-apply%20a%20filter%20when%20my%20table%20changes%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1888328%22%20slang%3D%22de-DE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F869126%22%20target%3D%22_blank%22%3E%40Ian_Heath%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22VIiyi%22%3E%3CSPAN%20class%3D%22JLqJ4b%20ChMk0b%22%3E%3CSPAN%3EApart%20from%20what%20with%20VBA%20in%20the%20style%20as%20you%20described%20it%2C%20I%20can't%20think%20of%20anything.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EPrivate%20Sub%20Worksheet_Activate%20()%0A%20%20%20%20%20Selection.AutoFilter%20Field%3A%20%3D%201%2C%20Criteria1%3A%20%3D%20%22%26gt%3B%200%22%2C%20Operator%3A%20%3D%20xlOr%2C%20_%0A%20%20%20%20%20%20%20%20%20Criteria2%3A%20%3D%20%22%26lt%3B%26gt%3B%200%22%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22VIiyi%22%3E%3CSPAN%20class%3D%22JLqJ4b%20ChMk0b%22%3E%3CSPAN%3EYou%20must%20insert%20the%20macro%20in%20the%20VBA%20editor%20under%20the%20table.%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22VIiyi%22%3E%3CSPAN%20class%3D%22JLqJ4b%20ChMk0b%22%3E%3CSPAN%3EThe%20filter%20is%20always%20updated%20when%20you%20activate%20the%20table.%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22VIiyi%22%3E%3CSPAN%20class%3D%22JLqJ4b%20ChMk0b%22%3E%3CSPAN%3EYou%20may%20have%20to%20adjust%20the%20value%20for%20Filter%3A%20%3D%201%20if%20the%20automatic%20filter%20should%20%2F%20can%20be%20set%20for%20several%20columns%20in%20the%20table.%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22VIiyi%22%3E%3CSPAN%20class%3D%22JLqJ4b%20ChMk0b%22%3E%3CSPAN%3EThe%20drop-down%20arrows%20are%20then%20counted%20from%20left%20to%20right%20up%20to%20column%20C.%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22VIiyi%22%3E%3CSPAN%20class%3D%22JLqJ4b%20ChMk0b%22%3E%3CSPAN%3EYou%20then%20have%20to%20use%20this%20value%20instead%20of%201.%3C%2FSPAN%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%20class%3D%22VIiyi%22%3E%3CSPAN%20class%3D%22JLqJ4b%20ChMk0b%22%3EKnowing%20the%20Excel%20version%20and%20operating%20system%20would%20also%20be%20an%20advantage%20!!!%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20be%20happy%20to%20know%20if%20I%20could%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E*%20Kindly%20Mark%20and%20Vote%20this%20reply%20if%20it%20helps%20please%2C%20as%20it%20will%20be%20beneficial%20to%20more%20community%20members%20reading%20here.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1888475%22%20slang%3D%22en-US%22%3EBetreff%3A%20How%20to%20get%20Excel%20to%20automatically%20re-apply%20a%20filter%20when%20my%20table%20changes%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1888475%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722750%22%20target%3D%22_blank%22%3E%40Nikolino%3C%2FA%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3EI%20use%20on%20ordinary%20filter%20(not%20a%20table%20filter)%20on%20just%20one%20column.%20So%20the%20VBA%20may%20be%20fairly%20simple.%20However%2C%20I'm%20not%20clear%20what%20activates%20the%20filter.%20I%20want%20it%20to%20be%20activated%20whenever%20data%20in%20that%20column%20is%20updated.%20I%20don't%20really%20understand%20how%20your%20VBA%20works.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOne%20other%20thing%2C%20I%20have%20always%20shy-ed%20away%20from%20VBA%20macros%20as%20they%20are%20a%20security%20risk%20which%20will%20put%20off%20most%20users.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI%20use%20excel%202019%20on%20Windows%2010%20and%20would%20dearly%20love%20to%20be%20to%20put%20it%20online%20to%20the%20public%20-%20but%20I%20haven't%20figured%20how%20to%20do%20this%20yet.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI%20would%20gladly%20send%20you%20my%20workbook%20but%20it%20is%20difficult%20to%20understand%20without%20the%20accompanying%20research%20paper%2C%20which%20I%20have%20yet%20to%20write.%20It's%20an%20improvement%20on%20the%20standard%20%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FKermack%25E2%2580%2593McKendrick_theory%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FKermack%25E2%2580%2593McKendrick_theory%26nbsp%3B%3C%2FA%3E%26nbsp%3B%20SIR%20model%2C%20to%20make%20it%20spatial-and-temporal-sensitive%2C%20based%20on%20the%20results%20of%20my%20ABM-modeling.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIan%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1888733%22%20slang%3D%22en-US%22%3EBetreff%3A%20How%20to%20get%20Excel%20to%20automatically%20re-apply%20a%20filter%20when%20my%20table%20changes%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1888733%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F869126%22%20target%3D%22_blank%22%3E%40Ian_Heath%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPerhaps%20more%20simple%20variant%20as%20here%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.extendoffice.com%2Fdocuments%2Fexcel%2F4180-excel-refresh-filter-automatically.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EHow%20To%20Automatically%20Reapply%20Auto-Filter%20When%20Data%20Changes%20In%20Excel%3F%3C%2FA%3E%26nbsp%3Bworks%20in%20your%20case.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

I filter the rows that are greater than 1% in the INFECTIOUS column.  However, this filter is not reapplied when my data changes.  How can I get it to reapply the filter automatically?

8 Replies
Highlighted

@Ian_Heath 

With your permission, if I can recommend. It can help us all if you upload an Excel file (without sensitive data), no picture.

Knowledge of Excel version and the operating system is a must have if you want to proposing a reasonable solution (Example: office version e.g. 2016 or 2019 or 365 web or 365 pro, etc) and your operating system (e.g. Win10 (2004), Win 10 (1903), Mac, etc.).

 

Nevertheless, here is some general information about it.

Reapply a filter and sort, or clear a filter

https://support.microsoft.com/en-us/office/reapply-a-filter-and-sort-or-clear-a-filter-a46f7534-ce5c...

 

Thank you for your understanding and patience

Hope I was able to help you.

 

Nikolino

I know I don't know anything (Socrates)

 

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here

 

Highlighted
Thanks for the reference Nikolino. That helped me to discover that Ctl-Alt-L reapplies the filter. Which is an improvement. However, Ctl-Alt-L needs to applied on the Worksheet which contains the filter, whereas I need to do this on another Worksheet that contains the Chart affected by the parameters I change there. In addition, this is meant for use by the general scientific community without instruction to apply such tricks. What I really need is the filter to be reapplied automatically when the users change the parameters that change the filtered data.

Is there any way of reapplying a filter automatically?

Ian

Highlighted

@Ian_Heath 

Apart from what with VBA in the style as you described it, I can't think of anything.

 

 

Private Sub Worksheet_Activate ()
     Selection.AutoFilter Field: = 1, Criteria1: = "> 0", Operator: = xlOr, _
         Criteria2: = "<> 0"
End Sub

 

You must insert the macro in the VBA editor under the table.

The filter is then always updated when you activate the table.

You may have to adjust the value for Filter: = 1 if the automatic filter should / can be set for several columns in the table.

The drop-down arrows are then counted from left to right up to column C.

You then have to use this value instead of 1. 

 

Knowing the Excel version and operating system would also be an advantage !!!

 

I would be happy to know if I could help.

 

Nikolino

I know I don't know anything (Socrates)

 

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.

Highlighted

@Nikolino  

I use on ordinary filter (not a table filter) on just one column. So the VBA may be fairly simple. However, I'm not clear what activates the filter. I want it to be activated whenever data in that column is updated. I don't really understand how your VBA works.

 

One other thing, I have always shy-ed away from VBA macros as they are a security risk which will put off most users.


I use excel 2019 on Windows 10 and would dearly love to be to put it online to the public - but I haven't figured how to do this yet.


I would gladly send you my workbook but it is difficult to understand without the accompanying research paper, which I have yet to write. It's an improvement on the standard https://en.wikipedia.org/wiki/Kermack%E2%80%93McKendrick_theory   SIR model, to make it spatial-and-temporal-sensitive, based on the results of my ABM-modeling.

 

Ian

Highlighted
Best Response confirmed by Ian_Heath (Occasional Contributor)
Highlighted

@Sergei Baklan 

 

Terrific Sergei.  You are a star.  Does exactly what I wanted.

 

I have a question though.  I have always shied away from using VBA macros as they seem to be a security risk and other users of my workbook will be put off from accessing it.  Is that a problem with this as well?

 

Many, many thanks, Ian

Highlighted

@Ian_Heath 

Ian, you are welcome.

In this case that's quite simple code which you enter yourselves, thus that's safe. However, if you share workbook, other people could refuse to work with macro-enabled workbook. In organization ITS could test the workbook and give okay to use it. Or ITS won't to waste time testing each macro users bring, in such case they simply prohibit to use any macro. Or ITS trusts to protecting software installed within organization, they have regular backups of everything and allow users to use practically everything.

 

Approximately the same with individuals. I don't know how to prove them this or that macro-enabled file is safe. Security is always in conflict with usability, the only question is how to find the compromise.

Highlighted

@Sergei Baklan 

Sergei, once again, many thanks for your response which I read with great interest.

 

Unfortunately, it confirmed my fears.  My situation is that I am lone researcher developing a new mathematical model of virus transmission which I plan to publish.  In my research paper I hope to provide a link to a public online version of my spreadsheet so that readers can see live plots of the transmission dynamics according to the parameters they select, which would require the filter to be re-applied.  However, readers will not open a spreadsheet that is flagged as a security risk.  Please can you suggest a method of doing this that would avoid it being a security risk.  Frankly, I cannot see how an online spreadsheet can be a security risk but I admit to being very ignorant about online spreadsheets.