I'm pretty new to VBA, but found this code that inserts a default value. The problem is that i need to have a default value inserted in a column based on another column.
Say that in "Column A" it takes the value 1 if the row is active, and 0 if the row is inactive. If column "A1" = 1 it should insert 9999 in column "C1" if 0 it shouldn't do anything. Can anyone help me modify the code?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim C As Range, inter As Range, r As Range
Set C = Range("C9:C21")
Set inter = Intersect(C, Target)
If inter Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each r In inter
If r.Value = "" Then r.Value = 9999
Next r
Application.EnableEvents = True
End Sub
Again thank you