0

I have written this macro to UNDO any Filters Before saving the spreadsheet.

Here is my code:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
End Sub

It is working fine when I add Filter to a column and then click Save, The Filter is automatically removed. However, If I add Filter to a Date Format column, same does not happen. Any idea, why and what can be done to remedy the situation.

Thank you very much for your precious time and in apprehension of your help.

Best Regads

3
  • "However, If I add Filter to a Date Format column, same does not happen" - after you click Save? Sep 5, 2019 at 14:13
  • Yes after I click save.
    – WhiteRose
    Sep 5, 2019 at 15:01
  • If that column is in a table then the filter may belong to the table and not the worksheet. Sep 8, 2019 at 16:08

0

You must log in to answer this question.

Browse other questions tagged .