What I want to do is perform a running balance for data in column a. An example is when i have data in columnA, i want the balances to show in column B using VBA
For example,
ColA ColB
1 1
4 5 (1+4)
5 10 (1+4+5)
6 16 (1+4+5+6)
7 23
9 32
I have written a small code like this but am new to VBA.
*****************************************************************************************
Sub runbalance()
Dim wksht As Worksheet
Dim counter As Long
Set wksht = ActiveSheet
For counter = 1 To 10
wksht.Cells(counter, 1).Offset(0, 1).Value = Application.WorksheetFunction.Sum(wksht.Range("cells(1,1):cells(counter,1)")).Value
Next counter
End Sub
******************************************************************************************
But it's not working. Please help
For example,
ColA ColB
1 1
4 5 (1+4)
5 10 (1+4+5)
6 16 (1+4+5+6)
7 23
9 32
I have written a small code like this but am new to VBA.
*****************************************************************************************
Sub runbalance()
Dim wksht As Worksheet
Dim counter As Long
Set wksht = ActiveSheet
For counter = 1 To 10
wksht.Cells(counter, 1).Offset(0, 1).Value = Application.WorksheetFunction.Sum(wksht.Range("cells(1,1):cells(counter,1)")).Value
Next counter
End Sub
******************************************************************************************
But it's not working. Please help