i have date in A1 and number in B1, similarly date in D1 and number in E1. i want b1 and e1 to increment by 1 number whenever value changes in A1 and D1 respectively. i want the same logic to be applied to all the rows ex (if something changes in a2 then b2 should be incremented by 1 number, if something is updated in a3 then b3 should be be incremented by 1 number. similarly if d2 is updated then e2 should be incremented by 1 number and if d3 is updated then e3 should be incremented by 1 number.
i have tried using this VBA code
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
Application.EnableEvents = False
Range("B1").Value = Range("B1").Value + 1
Application.EnableEvents = True
End If
If Not Intersect(Target, Range("D1")) Is Nothing Then
Application.EnableEvents = False
Range("E1").Value = Range("E1").Value + 1
Application.EnableEvents = True
End If
End Sub
but its only working for those particular cells when i try to put range in them, its not working.