Hi All,
I use the below code for a few workbooks that my department uses, this unfilters the worksheets on opening. This was needed as some shared users were being annoying and saving the documents with columns filtered.
However, I now also need to apply this to a shared and protected workbook.
I have tried adding ActiveSheet.Unprotect at the start and ActiveSheet.Protect at the end to remove the protection but it isn't working.
Can anyone help please?
I use the below code for a few workbooks that my department uses, this unfilters the worksheets on opening. This was needed as some shared users were being annoying and saving the documents with columns filtered.
Code:
Private Sub Workbook_Open()
Dim sh As Variant
For Each sh In Worksheets
If sh.FilterMode Then sh.ShowAllData
Next
End Sub
However, I now also need to apply this to a shared and protected workbook.
I have tried adding ActiveSheet.Unprotect at the start and ActiveSheet.Protect at the end to remove the protection but it isn't working.
Can anyone help please?