Hi, everyone -
I'm having a problem with one of my projects. The project involves a spreadsheet that tracks vacancy loss for all of our housing units. I have the Auto-Filter turned on in all of the columns so that Staff can filter by employee, unit location, etc. The spreadsheet is on a shared drive where a number of employees use the data. The problem comes in when they filter one of the columns, but fail to "unfilter" it before the close or save. When this happens, and the next employee looks at the data, if they dont see that one of the columns is filtered, the data will look skewed.
I've tried to use the code below, to unfilter all of the columns but not turn off the Auto-Filter before closing and/or saving and it works great at home. When I try to use it at the office, doesn't seem to work.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
With wks
If .AutoFilterMode Then
If .FilterMode Then
.ShowAllData
End If
End If
End With
Next wks
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
With wks
If .AutoFilterMode Then
If .FilterMode Then
.ShowAllData
End If
End If
End With
Next wks
End Sub
Any ideas/suggestions would be great. Thanks
Frank