Hello
I have this code.
I try when fill column E or F then will fill two formula
in G2=E2-F2
G3=G2+E3-F3
G4=G3+E4-F4
and so on .
the code will show error in G2,G3 =#VALUE
any help guys,please?
I have this code.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lr As Long
If Target.Address = Range("G2").Address Or Target.Column = 5 Or Target.Column = 6 Then
Application.EnableEvents = False
lr = Cells(Rows.Count, "B").End(xlUp).Row
Range("G2").FormulaR1C1 = "=RC[-2]-RC[-1]"
Range("G3:G" & lr).FormulaR1C1 = "=R[-1]C+RC[-2]-RC[-1]"
Range("G3:G" & lr).Value = Range("G3:G" & lr).Value
Application.EnableEvents = True
End If
End Sub
in G2=E2-F2
G3=G2+E3-F3
G4=G3+E4-F4
and so on .
the code will show error in G2,G3 =#VALUE
any help guys,please?