• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Auto filter Range two cells

asparagus

Member
Hello master,

I want filtering data with condition date (Today + 3) from two cells

Lot Date Lot Date
1 13-Nov-14 5 9-sep-14
3 11-Nov-14 4 15-sep-14
6 16-Nov-14 11 4-Des-2014
8 8-Des-14 12 16-Nov-2014

and this my code
Code:
Range("B6:B2000", "D6:D2000").AutoFilter 1, Criteria1:=">" & stDate, _
Operator:=xlAnd, Criteria2:="<" & stDate1

I use this function but doesn't work well.

Thanks

AsparAgus
 
Hi @asparagus

This question relates to your last post. You want data to be filtered between two dates using the autofilter feature. I have written a post on this topic which you can see here;

Autofilter between dates

This should be able to be manipulated by yourself.

Takec care

Smallman
 
Hi smallman,

I glad your respond my post again, i try to open your link but doesn't loading.
maybe you can give me any reference smallman.

Thanks,

AsparAgus
 
Hi AsparAgus
,

in your code, 1 is setting the both criteria1 and criteria2 to be applied on same field(column).

Range("B6:B2000", "D6:D2000").AutoFilter 1, Criteria1:=">" & stDate, _
Operator:=xlAnd, Criteria2:="<" & stDate1

As you have two different columns, you need to put your code something like this.

Range("B6:B2000", "D6:D2000").AutoFilter 2, Criteria1:=">" & stDate, _
Operator:=xlAnd, _
Range("B6:B2000", "D6:D2000").AutoFilter 4, Criteria1:="<" & stDate1, _
Operator:=xlAnd,

Regards,
Prasad DN
 
Hi prasaddn,

thank you very much, i already try your code to my VBA and success to filter two column in my excel.

Regards,
AsparAgus
 
Back
Top