I'm new to the VBA coding, could you please let me know how can we
disable/enable a cell based on a condition which is dependent on other cell data
Disable Cells
-
-
-
Re: Disable Cells
i tried doing this i got an error. My requirement is my worksheet is protected
with few cells editable. Now based on the one of the data of editable cell I need to protect other cells to be entered. -
-
Re: Disable Cells
You can also try this code here:
Code
Display MorePrivate Sub Worksheet_Change(ByVal Target As Range) Dim R As Range Set R = Application.Intersect(Target, Range("A1,A2")) If R Is Nothing Then Exit Sub ActiveSheet.Unprotect If Range("A1").Value > "" Then Range("A2").Select Selection.Locked = False Selection.FormulaHidden = False End If ActiveSheet.Protect End Sub
This code should unlock cell A2 when you type in A1. Just remember to have cell A1 unlocked.
Alring -
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!