Easy question on formatting
Protecting/unprotecting the sheets can be done by using a macro recorded in a
separate workbook. That will keep it secure and available only to you.
Example:
Sub ProtectAllSheets()
Windows("file_to_protect.xls").Activate
Application.ScreenUpdating = False
For i = 1 To 14
Sheets(i).Select
ActiveSheet.Protect Password:="password"
ActiveSheet.EnableSelection = xlUnlockedCells
Next i
ActiveWorkbook.Protect Password:="password", Structu=True,
Windows:=False
Application.ScreenUpdating = True
End Sub
Similar code can be written to unlock the sheets.
Regards...
"glensfallslady" wrote:
I have a workbook with 14 worksheets. Each sheet has specific formatting and
all the sheets are protected.
Is there a macro I can build to unlock all sheets and to lock all sheets
that I can run when needed and block from view with a password?
Also, I did all the page set up manually. I'd like to do this with code
...so much easier to manage..but I can I have the code run when the
speadsheet is opened. Below is a sample of one of the sheets page setup, but
it doesn't work
With ActiveSheet.PageSetUp
.PrintTitleRows = "$1:$1"
.CenterHeader = "Report for " & Date
.CenterFooter = "November"
.RightFooter = "&P"
.PrintArea = "$A:$G"
.PrintGridlines = True
.Orientation = xlPortrait
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.CenterHorizontally = True
End With
|