Hello all,
Totally new to VBA.Found 2 subs that do what i need, but how do i combine them to work on same sheet? One sub will accumulate a cell by using 2 cells. The second sub automatically adds the date when ever i change the accumulating cell.
Example: I am using 4 columns A,B,C,D
Column A (Names)
Column B (Date)
Column C (Daily Entry)
Column D (Total)
C & D are the accumulating and when ever i change a cell in column C the cell in column D will accumulate and the cell in column B will update the date.
Make sense?
Here is first sub...
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = "A1" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("B1").Value = Range("B1").Value + .Value
Application.EnableEvents = True
End If
End If
End With
End Sub
Here is second sub...
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("A2:A100")) Is Nothing Then
With Target(1, 2)
.Value = Date
.EntireColumn.AutoFit
End With
End If
End Sub
I really dont know much at all about subs, i just searched out and found these already made, but have no clue as how to combine them.
Any help is much appreciated.
Thanks,
Troy
Bookmarks