We will enter and run two pieces of code:
1. put this in a standard module:
Sub set_up()
ActiveSheet.Unprotect
Cells.Locked = False
Cells.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True,
AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
ActiveSheet.EnableSelection = xlUnlockedCells
End Sub
It leaves all cells unlocked and the sheet protected. Run this once before
editing
2. put this event macro in the worksheet code area:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Range("B:B"), Target) Is Nothing Then
Exit Sub
End If
ActiveSheet.Unprotect
If Target.Value = "x" Then
Target.Offset(0, 1).Locked = True
Else
Target.Offset(0, 1).Locked = False
End If
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
ActiveSheet.EnableSelection = xlUnlockedCells
End Sub
This code checks every entry made in column B. If it is x, then the
adjacent cell in column C is locked. If it is not x, then the adjacent cell
in column C is unlocked.
If you have never used VBA before, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
--
Gary''s Student - gsnu200731
"Amanda" wrote:
I would like a cell to be locked or unfillable based on the results of
another cell.
For example:
Column B has a formula that the results are "" or "x".
If possible, I would like to lock Colum C for those that return an "x" value.
Is this possible?
Thanks
PS I saw a bunch of messages about code, but I have no idea what that is....