View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
sophie sophie is offline
external usenet poster
 
Posts: 38
Default Protection on Multiple Sheets

Ok this was too time consuming. I just need a code to put to protect all the
worksheets and then unprotect them when needed. Can you supply me with that?



Thanks,

"Dave Peterson" wrote:

If you hit alt-F8, you should see a list of macros available to you.

Select the "UnprotectAllSheets" macro and click Run.

If the list doesn't include these macros, then make sure you put the code into
the correct location.

If the macro starts, then stops with an error message, you'll have to share how
it broke--what line caused the trouble.

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Sophie wrote:

I used the following code:

Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim N As Single
For N = 1 To Sheets.Count
Sheets(N).Protect Password:="justme"
Next N
Application.ScreenUpdating = True
End Sub

I did the following:

Copied and pasted it into the VBA and ran the macro and saved changes but
then what do I do? How do I get it to unprotect?

Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim N As Single
For N = 1 To Sheets.Count
Sheets(N).Unprotect Password:="justme"
Next N
Application.ScreenUpdating = True
End Sub

Sub Protect_Selected_Sheets()
Set MySheets = ActiveWindow.SelectedSheets
For Each ws In MySheets
ws.Select
ws.Protect Password:="justme"
Next ws
End Sub

"Dave Peterson" wrote:

You may want to share the code you tried and explain why it didn't work.

Sophie wrote:

I have several sheets in one workbook that i want to protect all with the
same password. I tried some of the codes that were given but they did not
work for me. Can some one please help? Also if you can explain it thouroughly
for me as I am still learning this whole new macro thing.

In advance thanks

-Sofia

--

Dave Peterson
.


--

Dave Peterson
.