Eric Carolus
Board Regular
- Joined
- Sep 17, 2012
- Messages
- 128
- Office Version
- 2016
- Platform
- Windows
Good day Folks
Is there perhaps a way of shortening following code?
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("F9:F74")) Is Nothing Then
If Target = "" Then
Range("E" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("H9:H74")) Is Nothing Then
If Target = "" Then
Range("G" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("J9:J74")) Is Nothing Then
If Target = "" Then
Range("I" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("L9:L74")) Is Nothing Then
If Target = "" Then
Range("L" & Target.Row).ClearContents
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Not Intersect(Target, Range("N9:N74")) Is Nothing Then
If Target = "" Then
Range("M" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("P9:P74")) Is Nothing Then
If Target = "" Then
Range("O" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("R9:R74")) Is Nothing Then
If Target = "" Then
Range("Q" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("T9:T74")) Is Nothing Then
If Target = "" Then
Range("S" & Target.Row).ClearContents
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Not Intersect(Target, Range("V9:V74")) Is Nothing Then
If Target = "" Then
Range("U" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("X9:X74")) Is Nothing Then
If Target = "" Then
Range("W" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("Z9:Z74")) Is Nothing Then
If Target = "" Then
Range("Y" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AB9:AB74")) Is Nothing Then
If Target = "" Then
Range("AA" & Target.Row).ClearContents
End If
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Not Intersect(Target, Range("AD9:AD74")) Is Nothing Then
If Target = "" Then
Range("AC" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AF9:AF74")) Is Nothing Then
If Target = "" Then
Range("AE" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AH9:AH74")) Is Nothing Then
If Target = "" Then
Range("AG" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AJ9:AJ74")) Is Nothing Then
If Target = "" Then
Range("AI" & Target.Row).ClearContents
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Not Intersect(Target, Range("AL9:AL74")) Is Nothing Then
If Target = "" Then
Range("AI" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AN9:AN74")) Is Nothing Then
If Target = "" Then
Range("AM" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AP9:AP74")) Is Nothing Then
If Target = "" Then
Range("AO" & Target.Row).ClearContents
End If
End If
End Sub
Any and all help will be greatly appreciated.
Thank you
Eric
Is there perhaps a way of shortening following code?
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("F9:F74")) Is Nothing Then
If Target = "" Then
Range("E" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("H9:H74")) Is Nothing Then
If Target = "" Then
Range("G" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("J9:J74")) Is Nothing Then
If Target = "" Then
Range("I" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("L9:L74")) Is Nothing Then
If Target = "" Then
Range("L" & Target.Row).ClearContents
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Not Intersect(Target, Range("N9:N74")) Is Nothing Then
If Target = "" Then
Range("M" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("P9:P74")) Is Nothing Then
If Target = "" Then
Range("O" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("R9:R74")) Is Nothing Then
If Target = "" Then
Range("Q" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("T9:T74")) Is Nothing Then
If Target = "" Then
Range("S" & Target.Row).ClearContents
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Not Intersect(Target, Range("V9:V74")) Is Nothing Then
If Target = "" Then
Range("U" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("X9:X74")) Is Nothing Then
If Target = "" Then
Range("W" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("Z9:Z74")) Is Nothing Then
If Target = "" Then
Range("Y" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AB9:AB74")) Is Nothing Then
If Target = "" Then
Range("AA" & Target.Row).ClearContents
End If
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Not Intersect(Target, Range("AD9:AD74")) Is Nothing Then
If Target = "" Then
Range("AC" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AF9:AF74")) Is Nothing Then
If Target = "" Then
Range("AE" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AH9:AH74")) Is Nothing Then
If Target = "" Then
Range("AG" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AJ9:AJ74")) Is Nothing Then
If Target = "" Then
Range("AI" & Target.Row).ClearContents
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Not Intersect(Target, Range("AL9:AL74")) Is Nothing Then
If Target = "" Then
Range("AI" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AN9:AN74")) Is Nothing Then
If Target = "" Then
Range("AM" & Target.Row).ClearContents
End If
End If
If Not Intersect(Target, Range("AP9:AP74")) Is Nothing Then
If Target = "" Then
Range("AO" & Target.Row).ClearContents
End If
End If
End Sub
Any and all help will be greatly appreciated.
Thank you
Eric