Does anyone know of VBA code that I can write to programmatically unfilter an autofiltered worksheet before closing a workbook? My problem is that I have to do this as an add-in not a macro. It will be used in multiple workbooks. I currently have the following code in my .xla file and I know I'm missing something. The only action that is being performed is the Activeworkbook.save
Public Sub Workbook_BeforeClose(Cancel As Boolean)
On Error GoTo Workbook_BeforeCloseErr
For Each ws In Worksheets
If ws.FilterMode = True Then
MsgBox Err & ": " & Error
Thanks in advance for any help that you can give!