Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 271
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 772
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 271
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help w/ protecting all sheets cnote Excel Discussion (Misc queries) 6 June 27th 06 01:38 PM
Protecting Sheets Joyce Excel Worksheet Functions 3 March 20th 06 08:18 PM
Protecting Sheets albertmb Excel Discussion (Misc queries) 7 March 13th 06 09:13 PM
Protecting Multiple Sheets pjd Excel Discussion (Misc queries) 1 April 4th 05 05:02 PM
Protecting multiple sheets mik00725 Excel Discussion (Misc queries) 1 February 17th 05 02:36 AM


All times are GMT +1. The time now is 05:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"