JackDanIce
Well-known Member
- Joined
- Feb 3, 2010
- Messages
- 9,922
- Office Version
- 365
- Platform
- Windows
Hi,
Part of some code is following:
I want to test for dates greater than 30 June 2019, however, no matter how I replace xxxx, after the code runs, the filtered values are hidden.
If I then select the filter drop down arrow, check the applied filter and hit ok, then then updates and shows the right results.
I've tried:
But all have the same behaviour, filtered results not returned.
dataRng is a range that currently evaluates to address A19:K56
This however runs fine:
to show rows where date values are within next 7 days
J19:J56 has blank cells or dates, formatting and hidden chars have been checked for.
Recorded macro returns:
Which filters as expected, however, if I clear the filter and run recorded macro, all results are hidden.
Thoughts/comments please?
Thanks,
Jack
Part of some code is following:
Code:
dataRng.AutoFilter field:=10, Criteria1:=">" & xxxx
If I then select the filter drop down arrow, check the applied filter and hit ok, then then updates and shows the right results.
I've tried:
Code:
dataRng.AutoFilter field:=10, Criteria1:=">" & #30/06/2019#
dataRng.AutoFilter field:=10, Criteria1:=">" & DateSerial(Year(Date) + IIf(Month(Date) > 6, 1, 0), 6, 30)
dataRng is a range that currently evaluates to address A19:K56
This however runs fine:
Code:
dataRng.AutoFilter Field:=10, Criteria1:="<" & CDbl(Date + 7)
J19:J56 has blank cells or dates, formatting and hidden chars have been checked for.
Recorded macro returns:
Code:
Sub Macro1()
'
' Macro1 Macro
'
ActiveSheet.Range("$A$19:$K$56").AutoFilter Field:=10, Criteria1:= _
">30/06/2019", Operator:=xlAnd
End Sub
Thoughts/comments please?
Thanks,
Jack
Last edited: