hello everybody i recently constructed a very useful VBA macro, and it is operational but however i want it to be operational 2 area's in 1 sheet and unfortunately i'v been unlucky solving it, could anyone plz lay down a suggestion ? here's the original macro
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ARow As Integer
If Target.Cells.Count > 1 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
ARow = ActiveCell.Row - 1
If Target.Column = 5 Then
Range("F" & ARow).Value = Range("E" & ARow).Value + Range("F" & ARow).Value
End If
ErrHandler:
Application.EnableEvents = True
End Sub
aside from E and F i wanted the same equation but with H and I, what i ended up with is this
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ARow As Integer
If Target.Cells.Count > 1 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
ARow = ActiveCell.Row - 1
If Target.Column = 5 Or 8 Then
Range("F" & ARow).Value = Range("E" & ARow).Value + Range("F" & ARow).Value
Range("I" & ARow).Value = Range("H" & ARow).Value + Range("I" & ARow).Value
End If
ErrHandler:
Application.EnableEvents = True
End Sub
it seems ( E - F ) and ( H -F ) need to be separated from each other, because whatever is added in E its sending info to column I
thanks in advance.
Bookmarks