Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cell protection problem

Private Sub LockWorkBook()
Dim wrkSheetTot As Integer
Dim i As Integer
wrkSheetTot = ActiveWorkbook.Worksheets.Count
Sheets("Banking").Select
Activesheet.UnProtect "TEST"
Range("H4:H6").Select
Selection.Locked = False
For i = 1 To wrkSheetTot
ActiveWorkbook.Worksheets(i).Select
ActiveSheet.Protect "TEST", DrawingObjects:=True,
Contents:=True, Scenarios:=True
Next
ActiveWorkbook.Worksheets("Banking").Select
ActiveWorkbook.Worksheets("IncomeData").Visible = False
ActiveWorkbook.Worksheets("BankingData").Visible = False
ActiveWorkbook.Worksheets("TelephoneNos").Visible = False
ActiveWorkbook.Protect "TEST", Structu=True,
Windows:=False
End Sub

--
Regards,
Tom Ogilvy


"Alastair MacFarlane" wrote in message
...
Dear All,

I am trying to create a procedure that:

(a) Create an area on a sheet "Banking" that users can
enter values where the remainder of the spreadsheet is
locked.
(b) Loops round all the sheets in the workbook and locks
them.
(c) Hides the worksheets with the exception of the
sheet "Banking".
(d) Protects the workbook.

The problem I am having is that I get the message "The
cell you are trying to change is protected and therefore
read only". I cannot identify the cause of this message. I
have tried setting Application.DisplayAlerts = False to
stop the message or Break On All Errors, but with no luck.
Can anyone help me?

After I click on the error message the workbook is set up
the way I want it but I don’t want to see this message.

Private Sub LockWorkBook()
Dim wrkSheetTot As Integer
Dim i As Integer
wrkSheetTot = ActiveWorkbook.Worksheets.Count
Sheets("Banking").Select
Range("H4:H6").Select
Selection.Locked = False
For i = 1 To wrkSheetTot
ActiveWorkbook.Worksheets(i).Select
ActiveSheet.Protect "TEST", DrawingObjects:=True,
Contents:=True, Scenarios:=True
Next
ActiveWorkbook.Worksheets("Banking").Select
ActiveWorkbook.Worksheets("IncomeData").Visible = False
ActiveWorkbook.Worksheets("BankingData").Visible = False
ActiveWorkbook.Worksheets("TelephoneNos").Visible = False
ActiveWorkbook.Protect "TEST", Structu=True,
Windows:=False
End Sub



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
Problem with protection of cells Paul Excel Discussion (Misc queries) 3 October 30th 06 02:36 PM
Protection Problem Using A Network Duncan, UK Excel Discussion (Misc queries) 3 October 2nd 06 01:47 PM
Cell Protection vs. Worksheet Protection kmwhitt Excel Discussion (Misc queries) 4 September 24th 06 02:37 AM
VB Protection problem Rmagic Excel Worksheet Functions 1 November 22nd 05 10:27 PM
Protection Problem Dave123 Excel Discussion (Misc queries) 1 October 3rd 05 06:45 PM


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

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

About Us

"It's about Microsoft Excel"