Setting a second filter with VBA

Status
Not open for further replies.

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,220
Hello all

This line of code is part of a larger piece for emailing out a group email with an attached workbook which works fine.

The range is column "C" to Column "Z"

It filters on column "W" (Field 21) and the criteria is "Out"
I need to add an additional filter on this if possible

In column "Z" will be a date

I want to only see dates that are less than or equal to todays date but I am struggling to modify the filter.

Code:
                FilterRange.AutoFilter field:=FieldNum, Criteria1:=Cws.Cells(rnum, 1).Value
                FilterRange.AutoFilter field:=21, Criteria1:="*Out*"

Any help on this please would be great
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Can anyone help on this please

I have tried this but it's not working

Code:
'Filter the FilterRange on the FieldNum column
                FilterRange.AutoFilter Field:=FieldNum, Criteria1:=Cws.Cells(rnum, 1).Value
                FilterRange.AutoFilter Field:=21, Criteria1:="*Out*", Field:=24, Criteria2:="< Date()"
 
Upvote 0
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,896
Messages
6,175,262
Members
452,627
Latest member
KitkatToby

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