YTD calculation using same cell
One way:
Put this in your worksheet code module (right-click the worksheet tab
and choose View Code):
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = "A2" Then
If IsNumeric(.Value) Then
On Error Resume Next
Application.EnableEvents = False
.Offset(0, 1).Value = .Offset(0, 1).Value + .Value
.Offset(0, 2).Value = .Offset(0, 2).Value + .Value
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End With
End Sub
In article ,
Molly wrote:
I am creating a pipeline that has new data entered each week. I want the
weekly figure to automatically add on to the monthly figure.
Eg.
A B C
1 Weekly Monthly YTD
2 $100 $500 $600
The monthly will get cleared to $0 at the beginning of each month but I want
the YTD to continue increasing. So when I enter a figure into A2, I want it
to add on to C2 as well.
Help please - thanks
|