Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro and Protected Sheet Problem
I have macros that hide rows and I want to protect my sheet so individuals
will not be able to change any of the information. When the sheet is protected the macro will not work. It goes to a debuger. Is there a way to run my macros even though the sheet is protected? Thank you, Daniel |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro and Protected Sheet Problem
Just turn protection off temporarily for the sheet:
Sub YourMacro() Worksheets("SheetName").Unprotect ' macro code here Worksheets("SheetName").Protect End Sub -- - K Dales "Daniel R. Young" wrote: I have macros that hide rows and I want to protect my sheet so individuals will not be able to change any of the information. When the sheet is protected the macro will not work. It goes to a debuger. Is there a way to run my macros even though the sheet is protected? Thank you, Daniel |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro and Protected Sheet Problem
In your macro, unprotect the sheet, hide the rows, protect the sheet. HTH
Otto "Daniel R. Young" wrote in message ... I have macros that hide rows and I want to protect my sheet so individuals will not be able to change any of the information. When the sheet is protected the macro will not work. It goes to a debuger. Is there a way to run my macros even though the sheet is protected? Thank you, Daniel |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro and Protected Sheet Problem
Daniel,
There is an alternative - check out the below code... ======================================= Select UnProtected Cells ONLY This will prevent users from clicking on protected cells on all worksheets. Therefore, the warning message will not appear. The code must be enterred in the ThisWorkbook module. Note that the EnableSelection property must be reset each time the workbook is opened as it defaults to xlNoRestrictions. The worksheet(s) must first be unprotected to set the EnableSelection property and then must be protected for it to take effect. Private Sub Workbook_Open() Dim WS As Worksheet For Each WS In ThisWorkbook.Worksheets WS.Unprotect 'Password:="wxyz" WS.EnableSelection = xlUnlockedCells WS.Protect 'Password:="wxyz", UserInterfaceOnly:=True Next End Sub Regards, Greg Wilson 5/3/03 -- steveB Remove "AYN" from email to respond "Otto Moehrbach" wrote in message ... In your macro, unprotect the sheet, hide the rows, protect the sheet. HTH Otto "Daniel R. Young" wrote in message ... I have macros that hide rows and I want to protect my sheet so individuals will not be able to change any of the information. When the sheet is protected the macro will not work. It goes to a debuger. Is there a way to run my macros even though the sheet is protected? Thank you, Daniel |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro and Protected Sheet Problem
It worked thank you!
"Daniel R. Young" wrote: I have macros that hide rows and I want to protect my sheet so individuals will not be able to change any of the information. When the sheet is protected the macro will not work. It goes to a debuger. Is there a way to run my macros even though the sheet is protected? Thank you, Daniel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro & Protected sheet | Excel Discussion (Misc queries) | |||
Combobox problem in protected sheet | Excel Discussion (Misc queries) | |||
Problem doing Query to Access with Excel sheet protected | Excel Programming | |||
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet | Excel Programming | |||
Solver via VBA on protected sheet problem | Excel Programming |