The a a few approaches in doing this
1) Put a formula on the worksheet
=Sum(A1:Y1)
Then copy done the worksheet. The only problem if you keep on adding new
rows you need to copy done the entire column (to 65536) and you will have
zeroes in rows without data
2) Similar to 1 above except put an if statement. The only problem with the
IF is cell in not consider empty when no data is in the row.
=if(countA(A1:Y1)>0,Sum(A1:Y1),"")
3) Use a worksheet change function to add the formula when data is entered
in the cell
Sub worksheet_change(ByVal target As Range)
For Each cell In target
If Application.Intersect(target, Columns("Z")) Is Nothing Then
Range("Z" & target.Row).Formula = _
"=Sum(A" & target.Row & ":Y" & target.Row & ")"
End If
Next
End Sub
4) If you don't want a formula in the cell instead a real number
Sub worksheet_change(ByVal target As Range)
For Each cell In target
If Application.Intersect(target, Columns("Z")) Is Nothing Then
Range("Z" & target.Row).Formula = _
Evaluate("Sum(A" & target.Row & ":Y" & target.Row & ")")
End If
Next
End Sub