Sorting Dates (this is tough)

hellfire45

Active Member
Joined
Jun 7, 2014
Messages
462
So I want to autofilter a column but I want to sort it to show the values that are in the last weeks business days.
Let's say it is Monday, I want to autofilter to last week Mon-Fri. Let's say the code looks like this:
Code:
With wksdata2

.Range("A:BJ").AutoFilter Field:=152, Criteria1:=array(today()-3, today()-4, Operator:=xlOr

endwith

Can anybody tell me how to write the criteria so that it does this properly?

Thanks!!!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I think I'm close with

Code:
wksdata2.Range("A:BJ").AutoFilter Field:=152, Criteria1:=Array(Date - 9, Date - 8, Date - 7, Date - 6), Operator:=xlOr

but its still not working.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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