View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
[email protected] mrlanier@hotmail.com is offline
external usenet poster
 
Posts: 63
Default A cell's value renders a workbook read-only

Sean,

Is it possible to place the elements of this macro within the already
existing macro I am using in Sheet1 by pasting the range under Private
Sub... as follows?

Private Sub Worksheet_Change(ByVal TargetCell As Range)
If (Range("A1") = 1) Then
Range("A1").Select
Selection.Locked = False
Selection.FormulaHidden = False
ActiveWorkbook.Protect Structu=True, Windows:=False
ElseIf (Range("A1") = 2) Then
ActiveWorkbook.Unprotect
End If
End Sub

Also, if possible, I need to avoid the use of a button to execute the
macro. Perhaps the macro can be executed as an entry is entered in the
worksheet. Can this work?

Michael