Hi,
I have a date column at column 16. I want to filter between July 1, 2022 and July 31, 2022 and include all the blanks, as well. My code lines below didn't seem to work for me. If you can help, I will be very thankful.
Sub function1()
startdate = #7/1/2022#
enddate = #7/31/2022#
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Test")
sh.UsedRange.AutoFilter 16, "=", xlOr, "<=" & enddate
sh.UsedRange.AutoFilter 16, ">=" & startdate, xlOr, "="
End Sub
I have a date column at column 16. I want to filter between July 1, 2022 and July 31, 2022 and include all the blanks, as well. My code lines below didn't seem to work for me. If you can help, I will be very thankful.
Sub function1()
startdate = #7/1/2022#
enddate = #7/31/2022#
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Test")
sh.UsedRange.AutoFilter 16, "=", xlOr, "<=" & enddate
sh.UsedRange.AutoFilter 16, ">=" & startdate, xlOr, "="
End Sub