Macro to unfilter columns on exit of a workbook

BigCoolBob

New Member
Joined
Jun 17, 2008
Messages
4
Hi

I have a problem in that I have a number of users with access to a workbook that contains scheduling information across a number of worksheets. Each of these users obviously filters the data to highlight their own specific scheduled work, however, very rarely do they unfilter the list once they have finished, and many other users go in, see the filtered list and exit without getting the work that they need to do as they cant see their name.

I have created pop up boxes on entry and exit into the workbook reminding them to unfilter the list before they save and close, however, these messages go largely unheeded.

Is there a way to add a macro into the workbook that will automatically unfilter the columns in all worksheets when the workbook is closed, or is there a way to unfilter the list when the next person opens the workbook? I am currently going into the workbook multiple times a day just to remove the filters otherwise work isnt being picked up and therefore not being done.

Many thanks for any assistance you can give.

Ian
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Sure. For instance

Code:
On Error Resume Next
    For Each ws In ThisWorkbook.Worksheets
        ws.AutoFilterMode = False
    Next
 
Upvote 0
You'll probably need to adapt it to suit your needs
Add this to Workbook/BeforeClose in VB.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
End Sub
 
Upvote 0
Thanks for your replies.

Wigi, I have got yours in my workbook, and it removes the filter completely rather than just unfiltering it and leaving the filter arrows in the sheet. Is there a way to unfilter it rather than remove the filter arrows completely?

Thanks again
 
Upvote 0
Then use:

Code:
On Error Resume Next
    For Each ws In ThisWorkbook.Worksheets
          If ws.FilterMode Then ws.ShowAllData
    Next
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top