snapper1
asked on
Excel Filter macro on two variables
Sub Macro3()
'
' Macro3 Macro
'
'
ActiveSheet.Range("$A$39:$ DL$22265") .AutoFilte r Field:=52, Criteria1:= _
">=Para_Age_Min", Operator:=xlAnd, Criteria2:="<=Para_Age_Max "
End Sub
I have two variable
Para_Age_Min and and Para_Age_Max and am trying to write a macro which will sort a database ("$A$39:$DL$22265") by filtering only records that are >=Para_Age_Min and <=Para_Age_Max
Para_Age_Min and Para_Age_Max are numbers such as 2 and 6 and so I am trying to filter for example >=2 and <=6 for records in column 52
I am sure this problem would probably have been addressed in the past but my macro wont work as it return no records when it filters.
ie no records meet the criteria even though there are records that
I havent attached a file as it is simply too big but would appreciate if anybody can see if my rather simple macro has some form of logic or other problem
Thanks
Paul Collins
'
' Macro3 Macro
'
'
ActiveSheet.Range("$A$39:$
">=Para_Age_Min", Operator:=xlAnd, Criteria2:="<=Para_Age_Max
End Sub
I have two variable
Para_Age_Min and and Para_Age_Max and am trying to write a macro which will sort a database ("$A$39:$DL$22265") by filtering only records that are >=Para_Age_Min and <=Para_Age_Max
Para_Age_Min and Para_Age_Max are numbers such as 2 and 6 and so I am trying to filter for example >=2 and <=6 for records in column 52
I am sure this problem would probably have been addressed in the past but my macro wont work as it return no records when it filters.
ie no records meet the criteria even though there are records that
I havent attached a file as it is simply too big but would appreciate if anybody can see if my rather simple macro has some form of logic or other problem
Thanks
Paul Collins
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The second one worked first go . The first may also worked but as I was using a named range I only tried the second