Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
lock cell
Can anyone help me with the following code? I am trying to lock a row based
on the results of two formulas. If either one of the results are greater then a certain value then the row will lock. The following code locks the cell if the first condition is met but not the second. Is there another way I could get it to check the second condition. Any help would be greatly appreciated. Thanks, Mike Private Sub Worksheet_Calculate() Dim myCell As Range On Error GoTo ws_exit: Application.EnableEvents = False ActiveSheet.Unprotect Password:="justme" For Each myCell In Range("O7:O37") If myCell.Value 100 Or myCell.Offset(0, 2).Value 12.5 Then Range(myCell.Offset(0, -1), myCell.Offset(0, -13)).Locked = True Else Range(myCell.Offset(0, -1), myCell.Offset(0, -13)).Locked = False End If Next myCell ActiveSheet.Protect Password:="justme" ws_exit: Application.EnableEvents = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to lock a cell value when values going into that cell keep changing... | Excel Discussion (Misc queries) | |||
I have lock a wookbook but one cell does not want to lock it | Excel Discussion (Misc queries) | |||
I have lock a wookbook but one cell does not want to lock it | Excel Discussion (Misc queries) | |||
How to lock a cell | Excel Worksheet Functions | |||
Lock data in a cell a specific cell based on selection on other ce | Excel Worksheet Functions |