Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Protecting Multiple Sheets
I entered the following code
Sub ProtectAll() Dim wSheet As Worksheet Dim Pwd As String Pwd = InputBox("Enter your password to protect all worksheets", "Password Input") For Each wSheet In Worksheets wSheet.Protect Password:=Pwd Next wSheet End Sub But when i run the code i get an error and all it says is "400", can someone hep me, i am trying to protect 52 sheets at one time Thanks |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Protecting Multiple Sheets
I copy and pasted your exact code and it works, even tried with 100 sheets.
Where are you putting your code and what version? -- -John Please rate when your question is answered to help us and others know what is helpful. "SUSAN" wrote: I entered the following code Sub ProtectAll() Dim wSheet As Worksheet Dim Pwd As String Pwd = InputBox("Enter your password to protect all worksheets", "Password Input") For Each wSheet In Worksheets wSheet.Protect Password:=Pwd Next wSheet End Sub But when i run the code i get an error and all it says is "400", can someone hep me, i am trying to protect 52 sheets at one time Thanks |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Protecting Multiple Sheets
I am right clicking on the worksheet tab and clicking on view code and then
entering the code, then go to the worksheet and click on macors and run the macro using version 2003, am i putting it in the wrong area? "John Bundy" wrote: I copy and pasted your exact code and it works, even tried with 100 sheets. Where are you putting your code and what version? -- -John Please rate when your question is answered to help us and others know what is helpful. "SUSAN" wrote: I entered the following code Sub ProtectAll() Dim wSheet As Worksheet Dim Pwd As String Pwd = InputBox("Enter your password to protect all worksheets", "Password Input") For Each wSheet In Worksheets wSheet.Protect Password:=Pwd Next wSheet End Sub But when i run the code i get an error and all it says is "400", can someone hep me, i am trying to protect 52 sheets at one time Thanks |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Protecting Multiple Sheets
Yes you are, you should put it in a regular module, press alt + F11, select
the file in the project pane to the left and select insert module, that's where to put it Then you run the macro from Alt + F8 or attach it to a button or a menu -- Regards, Peo Sjoblom "SUSAN" wrote in message ... I am right clicking on the worksheet tab and clicking on view code and then entering the code, then go to the worksheet and click on macors and run the macro using version 2003, am i putting it in the wrong area? "John Bundy" wrote: I copy and pasted your exact code and it works, even tried with 100 sheets. Where are you putting your code and what version? -- -John Please rate when your question is answered to help us and others know what is helpful. "SUSAN" wrote: I entered the following code Sub ProtectAll() Dim wSheet As Worksheet Dim Pwd As String Pwd = InputBox("Enter your password to protect all worksheets", "Password Input") For Each wSheet In Worksheets wSheet.Protect Password:=Pwd Next wSheet End Sub But when i run the code i get an error and all it says is "400", can someone hep me, i am trying to protect 52 sheets at one time Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help w/ protecting all sheets | Excel Discussion (Misc queries) | |||
Protecting Sheets | Excel Worksheet Functions | |||
Protecting Sheets | Excel Discussion (Misc queries) | |||
Protecting Multiple Sheets | Excel Discussion (Misc queries) | |||
Protecting multiple sheets | Excel Discussion (Misc queries) |