View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default remembering the same filtering criteria

Dear All,

I would like to know that is there any way of recording criteria when
I filtered data. For example; A1,A2,A3,A4,A5,A6,A7,A8,A9,A10 and A11
I have this data such as Data,1,2,3,4,5,6,7,8,9,10. Now when I
created auto filter as

ActiveSheet.Range("$A$2:$A$11").AutoFilter Field:=1,
Criteria1:=Array("2", "3", "4", "5"), Operator:=xlFilterValues

And this criteria can be changed by the user anytime. Now for some
reason sometimes I trigger a code which works under Function key(F8)
and it refresh some data from the database. Just before it gets the
data, it will show all data as :

ActiveSheet.Range("$A$1:$A$11").AutoFilter Field:=1

My problem is I want excel to remember criteria after I get the data
from database and filter as I previously did. Is there anyway of
doing it?

Thank you very much for the help
Baha


Why not store the criteria in a cell, OR a VBA global variable so it
holds the value for the life of runtime or until a user changes it.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion