AutoFilter on Dates over two years

Beepee

New Member
Joined
Apr 11, 2022
Messages
6
Office Version
  1. 2019
Platform
  1. Windows
My garden almanac worksheet records actioned dates for various tasks. The gardening year runs 1 Oct -- 30 Sep.
I am trying to filter out text/blank cells in a column all other entries are dates in the format: 22/10/2022
The range of dates spread over two years -- 1 Oct to 30 Sep. The following code results in filtering out all except the 'previous' year entries - i.e. 1 Oct to 32 Dec. Where have I gone wrong please?

'show only dates in Action Date column
With objList.Range
.AutoFilter Field:=lngFilter1, _
Operator:=xlFilterDynamic, _
Criteria1:=xlFilterLastYear, _
Operator:=xlAnd, Criteria2:=xlFilterYearToDate
End With

Many thanks in anticipation.
Beepee
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,223,250
Messages
6,171,036
Members
452,374
Latest member
keccles

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