How do I check if a range already has autofilters, and apply them if not.
At the moment I am simply using
Range("A1:N1").AutoFilter
However if that range already has Filters on it turns them off.
I have searched for this and found lots of solutions to clearing and reseting autofilters, but none about actually checking if filters are actually applied.
Your current solution should work fine but you could use an If statement like
If Sheets(curSheet).AutoFilterMode = True Then
'Do Nothing
Else
Sheets(curSheet).Range("A1").AutoFilter
End If
Rather than checking I just turned off AutoFilter before reapply.
Sheets(curSheet).AutoFilterMode = False
Range("A1:N1").AutoFilter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With