How to perform a running total in Excel vba.

excelway

New Member
Joined
Jan 30, 2015
Messages
13
I have a sheet with four columns i.e Credit,Debit and Balance.I want VBA help for running total in the colum of Balance

Code:
Credit                 Debit                        Balance
            
           3                         0                              3
         
           8                         0                             11

           0                        5                              6

          0                          2                              4

         10                        0                                14

and so on ....





Please let me help to write the vba code for the above caculation.

Thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Why VBA? A simple Excel formula will return this.
For example, if your data was in cells A2:B6, put this formula in cell C2:
=A2-B2
and then this formula in cell C3 and copy down to C6:
=C2+A3-B3
and there you have your running total.

If VBA, is this part of a bigger procedure? If so, please post that code.
Otherwise, you need to tell us exactly where the VBA code is to get the inputs from, and what it is doing with the running total (returning it somewhere)?
 
Upvote 0
I know the formula but i don't like the formulas in excel sheet because it slow the excel.I want direct vba code to perform the running total.
 
Upvote 0
Your request is a little too generic. We need details.

How/when do you want the VBA code to run (automated?, called manually? on existing data or as data is entered?)

What is the structure of your data (specific columns/rows, etc)?
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top