The simple way to avoid this is not to use the worksheet method ShowAllData
Autofilter has the same ShowAllData method which doesn't throw an error when the filter is enabled but no filter is set
If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilter.ShowAllData