Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Target.Parent.Range("Moving_Stock_out")
If Target.Count > 1 Then Exit Sub
If Intersect(Target, rng) Is Nothing Then Exit Sub
Target.Offset(, 15).Value = Date
n = Range("g65535").End(xlUp).Row
For i = 8 To n
If Not (Intersect(Target, Range("G" & i)) Is Nothing) Then
Range("J" & i).Value = Range("J" & i).Value + Range("G" & i).Value
End If
If Not (Intersect(Target, Range("H" & i)) Is Nothing) Then
Range("J" & i).Value = Range("J" & i).Value - Range("H" & i).Value
End If
Next
n = Range("r65535").End(xlUp).Row
For i = 8 To n
If Not (Intersect(Target, Range("R" & i)) Is Nothing) Then
Range("T" & i).Value = Range("T" & i).Value + Range("R" & i).Value
End If
If Not (Intersect(Target, Range("S" & i)) Is Nothing) Then
Range("T" & i).Value = Range("T" & i).Value - Range("S" & i).Value
End If
Next
End Sub
I wrote this code, however after apply the code, only the update date function and the code below is working, the others function all cant work
If Not (Intersect(Target, Range("H" & i)) Is Nothing) Then
Range("J" & i).Value = Range("J" & i).Value - Range("H" & i).Value
End If
Next