I have the below code
What it does, as you know, is that when column A is deleted, it proceeds in deleting column B of the same row.
The problem is when the user deletes more than 1 row e.g. A2:A10. When the user does this, the code only deletes B2 but not B3:B10.
Is there a way to have the code delete the column B for all affected rows?
Thanks
Code:
Private Sub worksheet_change(ByVal target As Range)
Dim rr As Integer
rr = target.Row
Application.EnableEvents = False
On Error Resume Next
If Not Intersect(target, Columns(1)) Is Nothing Then
If target.Value = "" Then
Cells(rr, 2).Value = ""
Else
Cells(rr, 2).FormulaR1C1 = _
"=RC1+RC2"
End If
Application.EnableEvents = True
End If
End Sub
What it does, as you know, is that when column A is deleted, it proceeds in deleting column B of the same row.
The problem is when the user deletes more than 1 row e.g. A2:A10. When the user does this, the code only deletes B2 but not B3:B10.
Is there a way to have the code delete the column B for all affected rows?
Thanks