I am a newby when it comes to working with VBA a Macros so please excuse my ignorance. I appreciate the help I have found on this forum.
64-bit operating system with Excel 2016 32-bit
I have a workbook with 3 worksheets. Sheet one (Action Plan) contains a table with filters turned on that will need to be protected. Multiple people will be using this worksheet with filters so I am needing a code that will automatically reset the filters on a protected worksheet upon opening. (If it help at all, users will only need to interact with Sheet One)
I have a code that works for clearing the filters when opening the workbook, but it only works when the worksheet is not protected. Please see the code below. Where do I add the code to unprotect and then protect the worksheet? Also, when using VBA to protect/unprotect, do I still protect the worksheet from the toolbar before closing?
Thanks in advance for your help!
cwmlpn
64-bit operating system with Excel 2016 32-bit
I have a workbook with 3 worksheets. Sheet one (Action Plan) contains a table with filters turned on that will need to be protected. Multiple people will be using this worksheet with filters so I am needing a code that will automatically reset the filters on a protected worksheet upon opening. (If it help at all, users will only need to interact with Sheet One)
I have a code that works for clearing the filters when opening the workbook, but it only works when the worksheet is not protected. Please see the code below. Where do I add the code to unprotect and then protect the worksheet? Also, when using VBA to protect/unprotect, do I still protect the worksheet from the toolbar before closing?
Code:
Private Sub Workbook_Open()
Dim wks As Worksheet
For Each wks In Worksheets
If wks.FilterMode = True Then
wks.ShowAllData
End If
Next wks
End Sub
Thanks in advance for your help!
cwmlpn