Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protecting and Unprotecting multiple sheets
Ok, I found the macros, but where do I enter them? I don't know the first thing about macros so bear with me..
I've got 31 sheets, one for each day of the week, so it's a major pain trying to fix stuff as I find it.. Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protecting and Unprotecting multiple sheets
What macros? You didn't say but I would imagine that you would want to put
in a regular module or the ThisWorkbook module would work. To put thereright click on the excel logo in the upper LEFT of the screenview codecopy/paste. Now, the question becomes, why one ws for each day. Why not one ws for all days that can be sorted or filtered to look at any one day. -- Don Guillett SalesAid Software "pkley" wrote in message ... Ok, I found the macros, but where do I enter them? I don't know the first thing about macros so bear with me... I've got 31 sheets, one for each day of the week, so it's a major pain trying to fix stuff as I find it... Thanks! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protecting and Unprotecting multiple sheets
Ok, that worked for the Protect code, but now I need to figure out how to also insert the unprotect code. It's almost the same as the protect stuff, I'm just too unfamiliar with VBA.
Public Sub UnProtectMultipleSheets() Const Pword As String = "drowssap" Dim WkSht As Worksheet For Each WkSht In Worksheets WkSht.Unprotect=Pword Next WkSht End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protecting and Unprotecting multiple sheets
I assume you've figured out the problem by now, but for the sake of anyone else reading...
Don't include the equal sign (=) between the Unprotect method and the password argument. Use it like this: WkSht.Unprotect Pword Also, you'll often want to remember the Protected state just before you Unprotect. You can use a series of Boolean variables to do that. Here's an example. Dim blnDrawingObjects As Boolean Dim blnContents As Boolean Dim blnScenarios As Boolean Dim blnAutoFilter As Boolean Dim blnOutlining As Boolean Dim blnPivotTable As Boolean Dim blnUserInterface As Boolean With ThisWorkbook.Worksheets("MyWorksheetName") ' ' remember the protection state of the sheet ' blnDrawingObjects = .ProtectDrawingObjects blnContents = .ProtectContents blnScenarios = .ProtectScenarios blnAutoFilter = .EnableAutoFilter blnOutlining = .EnableOutlining blnPivotTable = .EnablePivotTable blnUserInterface = .ProtectionMode .Unprotect "MyPassword" ' do some stuff here that requires unprotected sheet |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Protecting/Unprotecting all sheets with macro leads to "image" iss | Excel Worksheet Functions | |||
protecting and unprotecting | Excel Worksheet Functions | |||
Macro for protecting and unprotecting multiple worksheets | Excel Discussion (Misc queries) | |||
PROTECTING/UNPROTECTING SHEETS | Excel Discussion (Misc queries) | |||
Beta - unprotecting multiple sheets | Excel Programming |