Filter Problem??

brettvba

MrExcel MVP
Joined
Feb 18, 2002
Messages
1,030
Selection.AutoFilter Field:=8, Criteria1:=(<=dollarvalue), Operator:= _
xlAnd
what is wrong with the above I want to filter to less than or equal to dollarvalue
I have dim'd dollarvalue nothing seems to work help?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
It was recorded code I want to filter by a specified dollar amount eg $100 using a variable any other code would be of help?
 
Upvote 0
Ahh, sorry thought this was an Advanced AutoFilter. Is Field 8 your dollar amount field? You should be entering<=100.

Selection.AutoFilter Field:=8, Criteria1:="<=100", Operator:=xlAnd
This message was edited by Mark W. on 2002-03-14 15:04
 
Upvote 0
On 2002-03-14 14:47, brettvba wrote:
Selection.AutoFilter Field:=8, Criteria1:=(<=dollarvalue), Operator:= _
xlAnd

Try replacing the parenthesis with double quotes and drop the operator statement

Selection.AutoFilter Field:=8, Criteria1:="<=dollarvalue"
 
Upvote 0
that would work for text but i'm putting a variable in their, this is an autofilter thats being customised.
 
Upvote 0
On 2002-03-14 15:03, brettvba wrote:
that would work for text but i'm putting a variable in their, this is an autofilter thats being customised.

See my edited response above. :)
 
Upvote 0
I can do it to equal the variable by
Selection.AutoFilter Field:=8, Criteria1:=(dollarvalue), Operator:= _
xlAnd
but not less than or equal to?
 
Upvote 0
so what your saying mark is that you can't put a variable in a filter unless its equal to it?
 
Upvote 0
On 2002-03-14 15:05, brettvba wrote:
I can do it to equal the variable by
Selection.AutoFilter Field:=8, Criteria1:=(dollarvalue), Operator:= _
xlAnd
but not less than or equal to?

Would the & trick not work -- Criteria1:="<="&E1 where E1 houses a crit value?

Aladin
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,947
Members
448,534
Latest member
benefuexx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top