SuperWamJarice
New Member
- Joined
- Jan 10, 2018
- Messages
- 9
Good Afternoon,
I am new on the forum and I didn't find the answer to my problem within the existing posts so I hope you will be able to help me.
I created an excel document that includes over 200 sheets. The purpose is to have inputs from the production team on each sheet. The document is protected so that they only have access to defined cells and that can't do any formating of any kind.
My front sheet sums up the content of the workbook. It contains the titles and subtitles with hyperlinks to reach the sheets the production team needs to fill in.
It contains, as well, buttons (with macros) to hide/unhide the subtitles to ease the search.
That is where my issue starts : I need to be able to use those "hide/unhide" buttons whether my workbook is protected or not. To be more specific:
- If the workbook is not protected, I just want it to remain unprotected even after the hide/unhide macro has been launched.
- If the workbook is protected, I need the macro to unprotect the sheet, hide or unhide the rows the macro refers to and then reprotect the sheet.
Here is one of the thousand codes I made to do that operation:
and of course, it doesn't work!
If I just do unprotect at the begining of my macro to reprotect at the end it means that if my workbook is unprotected, as soon as I will use the macro, ok, it will hide or unhide the rows but I will en up with a protected sheet which is particularly annoying and time consuming when I am editing the document.
I hope this is clear enough...
Is anyone able to give me a hand on that issue?
Thank you very much in advance
Regards
PS: excuse my english, I am french !
I am new on the forum and I didn't find the answer to my problem within the existing posts so I hope you will be able to help me.
I created an excel document that includes over 200 sheets. The purpose is to have inputs from the production team on each sheet. The document is protected so that they only have access to defined cells and that can't do any formating of any kind.
My front sheet sums up the content of the workbook. It contains the titles and subtitles with hyperlinks to reach the sheets the production team needs to fill in.
It contains, as well, buttons (with macros) to hide/unhide the subtitles to ease the search.
That is where my issue starts : I need to be able to use those "hide/unhide" buttons whether my workbook is protected or not. To be more specific:
- If the workbook is not protected, I just want it to remain unprotected even after the hide/unhide macro has been launched.
- If the workbook is protected, I need the macro to unprotect the sheet, hide or unhide the rows the macro refers to and then reprotect the sheet.
Here is one of the thousand codes I made to do that operation:
Code:
Sub groupePREF()
If ActiveSheet.Protect(Content) = True Then
ActiveSheet.UnProtect Mdp
With Rows("4:74")
If Not .Hidden Then .Hidden = True Else .Hidden = False
End With
Range("23:25,27:29,31:33,35:37,39:41,43:63,66:68,70:72").Select
Selection.EntireRow.Hidden = True
Range("A4").Select
ActiveSheet.Protect Mdp
Else
With Rows("4:74")
If Not .Hidden Then .Hidden = True Else .Hidden = False
End With
Range("23:25,27:29,31:33,35:37,39:41,43:63,66:68,70:72").Select
Selection.EntireRow.Hidden = True
Range("A4").Select
End If
End Sub
and of course, it doesn't work!
If I just do unprotect at the begining of my macro to reprotect at the end it means that if my workbook is unprotected, as soon as I will use the macro, ok, it will hide or unhide the rows but I will en up with a protected sheet which is particularly annoying and time consuming when I am editing the document.
I hope this is clear enough...
Is anyone able to give me a hand on that issue?
Thank you very much in advance
Regards
PS: excuse my english, I am french !