greggmorgangolf
New Member
- Joined
- Jul 4, 2023
- Messages
- 5
- Office Version
- 365
- Platform
- Windows
Hi,
I have written a relatively simple IF code to reset my dropdown lists in the top row of my data if the depentent cell value changes.
I want to repeat this code for a range (columns C to L) of rows in the worksheet (2000 or so). I am hoping this is relatively simple? Could anyone help please?
Code below:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$4" Then
Range("D4:L4").Value = "Select..."
End If
If Target.Address = "$D$4" Then
Range("E4:L4").Value = "Select..."
End If
If Target.Address = "$E$4" Then
Range("F4:L4").Value = "Select..."
End If
If Target.Address = "$F$4" Then
Range("G4:L4").Value = "Select..."
End If
If Target.Address = "$G$4" Then
Range("H4:L4").Value = "Select..."
End If
If Target.Address = "$H$4" Then
Range("I4:L4").Value = "Select..."
End If
If Target.Address = "$I$4" Then
Range("J4:L4").Value = "Select..."
End If
If Target.Address = "$J$4" Then
Range("L4").Value = "Select..."
End If
End Sub
Screenshot below of cells I want the code to repeat on based on the same logic in row 4. (Columns C to L are the range)
I have written a relatively simple IF code to reset my dropdown lists in the top row of my data if the depentent cell value changes.
I want to repeat this code for a range (columns C to L) of rows in the worksheet (2000 or so). I am hoping this is relatively simple? Could anyone help please?
Code below:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$4" Then
Range("D4:L4").Value = "Select..."
End If
If Target.Address = "$D$4" Then
Range("E4:L4").Value = "Select..."
End If
If Target.Address = "$E$4" Then
Range("F4:L4").Value = "Select..."
End If
If Target.Address = "$F$4" Then
Range("G4:L4").Value = "Select..."
End If
If Target.Address = "$G$4" Then
Range("H4:L4").Value = "Select..."
End If
If Target.Address = "$H$4" Then
Range("I4:L4").Value = "Select..."
End If
If Target.Address = "$I$4" Then
Range("J4:L4").Value = "Select..."
End If
If Target.Address = "$J$4" Then
Range("L4").Value = "Select..."
End If
End Sub
Screenshot below of cells I want the code to repeat on based on the same logic in row 4. (Columns C to L are the range)