LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Macro problem with protecting worksheet...........

I have a workbook with 5 active worksheets. The firt worksheet is named
"request".
If "request" is the active worksheet, it locks the fields below.... if I am
on another worksheet, it does not lock the fields in "request" as noted
below.

What did I miss?
Thanks



Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

Sheets("Request").Range("K4") = Now
Set wks = Me.Worksheets("request")

ActiveWorkbook.Unprotect password:="mypassword"

ActiveSheet.Unprotect password:="mypassword"
Range("B4:B9").Select
Selection.Locked = True
Range("J2:M2").Select
Selection.Locked = True
Range("A26:L33").Select
Selection.Locked = True
Range("A14:L22").Select
Selection.Locked = True
Range("A39:L54").Select
Selection.Locked = True
Range("A55:L60").Select
Selection.Locked = True
Range("K4:K9").Select
Selection.Locked = True

ActiveSheet.Protect password:="mypassword"
ActiveWorkbook.Protect password:="mypassword"



End Sub


 
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
Protecting worksheet Patricia Excel Discussion (Misc queries) 1 March 15th 10 02:49 PM
Protecting worksheet Kimti Excel Worksheet Functions 1 July 6th 08 01:37 AM
Password Protecting an Excel file problem Tolga Excel Discussion (Misc queries) 2 March 6th 08 02:54 PM
hiding macro codes upon protecting the worksheet eehj23 Excel Discussion (Misc queries) 1 April 28th 06 03:55 AM
Protecting worksheet Shilps Excel Programming 2 April 27th 04 01:01 PM


All times are GMT +1. The time now is 05:38 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"