I have tried a bunch of approaches but no are working.
Most of the times the criteria (cells in column T not blank) is met and therefore I want to filter to those records, but if it is not met I want it left unfiltered.
I was thinking of a COUNTIF not blank and then using that variable so if it is >0 then filter, but I cannot figure out the COUNTIF statement.
Flags = WorksheetFunction.countif(Range("T2:T" & LastRow)) <> ""
If Flags > 0 Then
ActiveSheet.Range("$A$1:$Z" & LastRow).AutoFilter Field:=20, Criteria1:="<>"
End If
Any help is appreciated.
Most of the times the criteria (cells in column T not blank) is met and therefore I want to filter to those records, but if it is not met I want it left unfiltered.
I was thinking of a COUNTIF not blank and then using that variable so if it is >0 then filter, but I cannot figure out the COUNTIF statement.
Flags = WorksheetFunction.countif(Range("T2:T" & LastRow)) <> ""
If Flags > 0 Then
ActiveSheet.Range("$A$1:$Z" & LastRow).AutoFilter Field:=20, Criteria1:="<>"
End If
Any help is appreciated.