adamsm
07-09-2011, 10:12 AM
Hi anyone,
How could I make the following code to unlock blank cells in column G when a user types a value in cell J10 of the (protected) Active sheet.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Rng
Dim MyCell
Set Rng = Range("G18:G53")
For Each MyCell In Rng
If MyCell.Value = "" Then
Else: ActiveSheet.Unprotect
MyCell.Locked = True
MyCell.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoRestrictions
End If
Next
End Sub
Any help on this would be kindly appreciated.
Thanks in advance.
How could I make the following code to unlock blank cells in column G when a user types a value in cell J10 of the (protected) Active sheet.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Rng
Dim MyCell
Set Rng = Range("G18:G53")
For Each MyCell In Rng
If MyCell.Value = "" Then
Else: ActiveSheet.Unprotect
MyCell.Locked = True
MyCell.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoRestrictions
End If
Next
End Sub
Any help on this would be kindly appreciated.
Thanks in advance.