Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Easy question on formatting

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default 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

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
Conditional Formatting - Multiple Criteria Easy Question Ricardo Excel Discussion (Misc queries) 3 April 2nd 09 07:03 AM
probably an easy question Jason Excel Discussion (Misc queries) 4 February 7th 08 05:39 PM
Easy question M&M[_2_] Excel Discussion (Misc queries) 3 August 11th 07 07:00 AM
Easy Question dok112[_40_] Excel Programming 2 July 20th 05 11:48 PM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM


All times are GMT +1. The time now is 08:17 PM.

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

About Us

"It's about Microsoft Excel"