Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I have a sheet with protected cells. Everytime I re-open the file, the cells
become unprotected. How do I stop the cells from becoming unprotected? |
#2
![]() |
|||
|
|||
![]()
This isn't standard behavior.
Any chance you're opening the wrong workbook? Or your workbook opens and a macro runs that does the unprotecting? Roy wrote: I have a sheet with protected cells. Everytime I re-open the file, the cells become unprotected. How do I stop the cells from becoming unprotected? -- Dave Peterson |
#3
![]() |
|||
|
|||
![]()
I don't think so to either question. I only have one file and eventhough I
do have macros in the workbook to unprotect and protect, I did not make them run when the workbook is opened. I modified the macros that I found on this site. Here are the macros I'm using: Public Sub Unprotect_All() Dim wks As Worksheet Dim vPword As Variant On Error Resume Next For Each wks In ActiveWorkbook.Worksheets With wks .Unprotect vPword Do While .ProtectContents vPword = Application.InputBox( _ Prompt:="Enter password for " & .Name, _ Title:="Unprotect sheets", _ Default:="", _ Type:=2) If vPword = False Then Exit Sub 'user cancelled .Unprotect vPword Loop End With Next End Sub Public Sub Protect_All() Dim wks As Worksheet Dim vPword As Variant vPword = Application.InputBox( _ Prompt:="Enter Password: ", _ Title:="Protect sheets", _ Default:="", _ Type:=2) If vPword = False Then Exit Sub 'user cancelled For Each wks In ActiveWorkbook.Worksheets wks.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True wks.EnableSelection = xlUnlockedCells wks.Protect vPword Next End Sub "Dave Peterson" wrote: This isn't standard behavior. Any chance you're opening the wrong workbook? Or your workbook opens and a macro runs that does the unprotecting? Roy wrote: I have a sheet with protected cells. Everytime I re-open the file, the cells become unprotected. How do I stop the cells from becoming unprotected? -- Dave Peterson |
#4
![]() |
|||
|
|||
![]()
And you looked under the ThisWorkbook module for a Workbook_open routine that
might call the Unprotect_all subroutine (or even workbook_beforesave)???? And remember to check under the each worksheet, too. There could be code inside one of those modules that calls that routine. If that doesn't work, you can try this to eliminate the macro possibility: Close excel windows start button|run excel /safe (this'll start excel in safe mode and won't allow macros to run). File|Open your workbook. Protect the worksheets (manually). File|Save File|Close And then reopen while you're still in safe mode. If the worksheets are still protected, I'd keep looking for a macro problem. Roy wrote: I don't think so to either question. I only have one file and eventhough I do have macros in the workbook to unprotect and protect, I did not make them run when the workbook is opened. I modified the macros that I found on this site. Here are the macros I'm using: Public Sub Unprotect_All() Dim wks As Worksheet Dim vPword As Variant On Error Resume Next For Each wks In ActiveWorkbook.Worksheets With wks .Unprotect vPword Do While .ProtectContents vPword = Application.InputBox( _ Prompt:="Enter password for " & .Name, _ Title:="Unprotect sheets", _ Default:="", _ Type:=2) If vPword = False Then Exit Sub 'user cancelled .Unprotect vPword Loop End With Next End Sub Public Sub Protect_All() Dim wks As Worksheet Dim vPword As Variant vPword = Application.InputBox( _ Prompt:="Enter Password: ", _ Title:="Protect sheets", _ Default:="", _ Type:=2) If vPword = False Then Exit Sub 'user cancelled For Each wks In ActiveWorkbook.Worksheets wks.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True wks.EnableSelection = xlUnlockedCells wks.Protect vPword Next End Sub "Dave Peterson" wrote: This isn't standard behavior. Any chance you're opening the wrong workbook? Or your workbook opens and a macro runs that does the unprotecting? Roy wrote: I have a sheet with protected cells. Everytime I re-open the file, the cells become unprotected. How do I stop the cells from becoming unprotected? -- Dave Peterson -- Dave Peterson |
#5
![]() |
|||
|
|||
![]()
Dave,
Thanks for all your help with this. I looked at each one of my worksheets modules and ThisWorkbook module and they are all blank. The only macros I have are in Module1 and they are ones I copied on here on a previous message. I ran excel in safe mode as you suggested and the sheets were still protected after I reopened the file in safe mode. I'm not sure what else to do. I guess I'll have to run a macro when the file is opened that protects the worksheets but how do I do that without having to type in the password and having this macro not affect my other protect all macro? Roy "Dave Peterson" wrote: And you looked under the ThisWorkbook module for a Workbook_open routine that might call the Unprotect_all subroutine (or even workbook_beforesave)???? And remember to check under the each worksheet, too. There could be code inside one of those modules that calls that routine. If that doesn't work, you can try this to eliminate the macro possibility: Close excel windows start button|run excel /safe (this'll start excel in safe mode and won't allow macros to run). File|Open your workbook. Protect the worksheets (manually). File|Save File|Close And then reopen while you're still in safe mode. If the worksheets are still protected, I'd keep looking for a macro problem. Roy wrote: I don't think so to either question. I only have one file and eventhough I do have macros in the workbook to unprotect and protect, I did not make them run when the workbook is opened. I modified the macros that I found on this site. Here are the macros I'm using: Public Sub Unprotect_All() Dim wks As Worksheet Dim vPword As Variant On Error Resume Next For Each wks In ActiveWorkbook.Worksheets With wks .Unprotect vPword Do While .ProtectContents vPword = Application.InputBox( _ Prompt:="Enter password for " & .Name, _ Title:="Unprotect sheets", _ Default:="", _ Type:=2) If vPword = False Then Exit Sub 'user cancelled .Unprotect vPword Loop End With Next End Sub Public Sub Protect_All() Dim wks As Worksheet Dim vPword As Variant vPword = Application.InputBox( _ Prompt:="Enter Password: ", _ Title:="Protect sheets", _ Default:="", _ Type:=2) If vPword = False Then Exit Sub 'user cancelled For Each wks In ActiveWorkbook.Worksheets wks.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True wks.EnableSelection = xlUnlockedCells wks.Protect vPword Next End Sub "Dave Peterson" wrote: This isn't standard behavior. Any chance you're opening the wrong workbook? Or your workbook opens and a macro runs that does the unprotecting? Roy wrote: I have a sheet with protected cells. Everytime I re-open the file, the cells become unprotected. How do I stop the cells from becoming unprotected? -- Dave Peterson -- Dave Peterson |
#6
![]() |
|||
|
|||
![]()
Those macros you posted don't run automatically.
Any chance you have a "helpful" addin that's sticking it's head in? Since it worked ok in safe mode with macros disabled, I'd keep looking for macros. Chip Pearson has some notes on how to diagnose startup errors at: http://www.cpearson.com/excel/StartupErrors.htm And Jan Karel Pieterse has more notes at: http://www.jkp-ads.com/Articles/StartupProblems.htm Essentially, you move all of the stuff out of XLStart and you turn off all the addins under Toools|addins. Then you start adding things back one at a time and testing each time to see if the problem is fixed. When you add something back that causes the problem to come back, you'll have to decide what to do with that addin. (Make sure you keep track of all the stuff you turn off and move.) Roy wrote: Dave, Thanks for all your help with this. I looked at each one of my worksheets modules and ThisWorkbook module and they are all blank. The only macros I have are in Module1 and they are ones I copied on here on a previous message. I ran excel in safe mode as you suggested and the sheets were still protected after I reopened the file in safe mode. I'm not sure what else to do. I guess I'll have to run a macro when the file is opened that protects the worksheets but how do I do that without having to type in the password and having this macro not affect my other protect all macro? Roy "Dave Peterson" wrote: And you looked under the ThisWorkbook module for a Workbook_open routine that might call the Unprotect_all subroutine (or even workbook_beforesave)???? And remember to check under the each worksheet, too. There could be code inside one of those modules that calls that routine. If that doesn't work, you can try this to eliminate the macro possibility: Close excel windows start button|run excel /safe (this'll start excel in safe mode and won't allow macros to run). File|Open your workbook. Protect the worksheets (manually). File|Save File|Close And then reopen while you're still in safe mode. If the worksheets are still protected, I'd keep looking for a macro problem. Roy wrote: I don't think so to either question. I only have one file and eventhough I do have macros in the workbook to unprotect and protect, I did not make them run when the workbook is opened. I modified the macros that I found on this site. Here are the macros I'm using: Public Sub Unprotect_All() Dim wks As Worksheet Dim vPword As Variant On Error Resume Next For Each wks In ActiveWorkbook.Worksheets With wks .Unprotect vPword Do While .ProtectContents vPword = Application.InputBox( _ Prompt:="Enter password for " & .Name, _ Title:="Unprotect sheets", _ Default:="", _ Type:=2) If vPword = False Then Exit Sub 'user cancelled .Unprotect vPword Loop End With Next End Sub Public Sub Protect_All() Dim wks As Worksheet Dim vPword As Variant vPword = Application.InputBox( _ Prompt:="Enter Password: ", _ Title:="Protect sheets", _ Default:="", _ Type:=2) If vPword = False Then Exit Sub 'user cancelled For Each wks In ActiveWorkbook.Worksheets wks.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True wks.EnableSelection = xlUnlockedCells wks.Protect vPword Next End Sub "Dave Peterson" wrote: This isn't standard behavior. Any chance you're opening the wrong workbook? Or your workbook opens and a macro runs that does the unprotecting? Roy wrote: I have a sheet with protected cells. Everytime I re-open the file, the cells become unprotected. How do I stop the cells from becoming unprotected? -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do you "select locked cells" w/o "select unlocked cells"? | Excel Discussion (Misc queries) | |||
Protected Cells | Excel Discussion (Misc queries) | |||
To safety merge cells without data destroyed, and smart unmerge! | Excel Discussion (Misc queries) | |||
copy group of cells to another group of cells using "IF" in third | Excel Worksheet Functions | |||
How do you delete one cell from a range of protected cells | Excel Worksheet Functions |