-
Running total
Hello there
I am trying to do a running total, as we all know the first cell is A1, that first row is where the runing total will be. I have created a button such that when it is clicked a row is inserted, when a figure is entered in A1 and across, Row A2 becomes the total row and when the button is clicked again another row is inserted, figures are entered across and a running total will be in Row A3 subsequently. This is what i have done so far:
Accounts.Activate
Range("A1").Select
Selection.EntireRow.insert
can anyone help please?
many thanks
phay
-
Hi alphay,
Welcome to VBAX
The following code will works after the spreadsheet is "initialized". Insert a value in A1 and =A1 in A2. Thereafter the code will insert the appropriate formula.
Regards
MD
[VBA]
Sub InsRow()
Range("A1").EntireRow.Insert
Cells(Cells.Rows.Count, 1).End(xlUp).FormulaR1C1 = "=SUM(R1C1:R[-1]C)"
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules