Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Protecting a workbook
Hi,
I have no problem protecting a worksheet with the 'Protect Sheet' option, but is there anyway i can protect the whole workbook the same way, without having to select each sheet individually? Thanks in advanced! |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Protecting a workbook
Kim
When you click on Tools - Protection, you have the option of protecting the whole workbook. HTH Otto "Kim" wrote in message ... Hi, I have no problem protecting a worksheet with the 'Protect Sheet' option, but is there anyway i can protect the whole workbook the same way, without having to select each sheet individually? Thanks in advanced! |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Protecting a workbook
You may wish to note, Kim, that Protect Workbook does different things
than Protect Sheet. If you are wanting to protect many sheets at a time, you'll need a macro. |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Protecting a workbook
Hi Kim,
You can create a macro to take care of this. As part of the Macro, you will create a Form with a Command Button. You can then add the code to the Commnand button as follows. Private Sub CommandButton1_Click() Dim wSheet As Worksheet For Each wSheet In Worksheets If wSheet.ProtectContents = True Then wSheet.Unprotect Password:=TextBox1.Text Else wSheet.Protect Password:="replace this text with password you wish to open sheets with" End If Next wSheet Unload Me End Sub -- tech1NJ "Kim" wrote: Hi, I have no problem protecting a worksheet with the 'Protect Sheet' option, but is there anyway i can protect the whole workbook the same way, without having to select each sheet individually? Thanks in advanced! |
#5
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Protecting a workbook
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 Unprotect all sheets.................... 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 Protect selected sheets.......................... Sub Protect_Selected_Sheets() Application.ScreenUpdating = False Set MySheets = ActiveWindow.SelectedSheets For Each ws In MySheets ws.Select ws.Protect Password:="justme" Next ws Application.ScreenUpdating = True End Sub Unprotect selected sheets................ Sub UnProtect_Selected_Sheets() Application.ScreenUpdating = False Set MySheets = ActiveWindow.SelectedSheets For Each ws In MySheets ws.Select ws.UnProtect Password:="justme" Next ws Application.ScreenUpdating = True End Sub Gord Dibben MS Excel MVP On Thu, 25 Sep 2008 16:39:01 -0700, Kim wrote: Hi, I have no problem protecting a worksheet with the 'Protect Sheet' option, but is there anyway i can protect the whole workbook the same way, without having to select each sheet individually? Thanks in advanced! |
#6
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Protecting a workbook
Hi Kim,
Did you find my post useful? Please let me know. I like to make sure that you got what you needed. If so, please let me know by indicating so on the reply or the post itself. Thanks -- tech1NJ "Kim" wrote: Hi, I have no problem protecting a worksheet with the 'Protect Sheet' option, but is there anyway i can protect the whole workbook the same way, without having to select each sheet individually? Thanks in advanced! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
protecting workbook | Excel Discussion (Misc queries) | |||
Protecting a workbook | Excel Discussion (Misc queries) | |||
Protecting a workbook | Excel Discussion (Misc queries) | |||
Protecting Workbook!.. | Excel Worksheet Functions | |||
Protecting Workbook | Excel Discussion (Misc queries) |