Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filter column using criteria from a userform
I would like to filter a column based on criteria entered
into a userform. I've got this code so far using actual dates: Selection.AutoFilter Field:=51, Criteria1:="=01/06/2003", Operator:= _ xlAnd, Criteria2:="<=30/10/2003" BUT, I want to substitute the dates for variables that come from a date picker on the userform, ie =variablename I've tried: Criteria1:= = variablename Criteria1:= "=" variablename Criteria1:= "=variablename" - this picks up the words, not the variable But none of them work - what syntax do I use? Please help. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filter column using criteria from a userform
Use an ampersand to join the operator and variable:
Selection.AutoFilter Field:=51, Criteria1:="=" & Variable1, _ Operator:=xlAnd, Criteria2:="<=" & Variable2 Eileen wrote: I would like to filter a column based on criteria entered into a userform. I've got this code so far using actual dates: Selection.AutoFilter Field:=51, Criteria1:="=01/06/2003", Operator:= _ xlAnd, Criteria2:="<=30/10/2003" BUT, I want to substitute the dates for variables that come from a date picker on the userform, ie =variablename I've tried: Criteria1:= = variablename Criteria1:= "=" variablename Criteria1:= "=variablename" - this picks up the words, not the variable But none of them work - what syntax do I use? Please help. Thanks -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Filter duplicates based on criteria / column values | Excel Discussion (Misc queries) | |||
Find record by multi criteria in userform | Excel Discussion (Misc queries) | |||
filter or format based on criteria in more than one column | Excel Worksheet Functions | |||
"Criteria Range" in the "Data/Filter/Advanced Filter" to select Du | Excel Worksheet Functions |