Link to home
Start Free TrialLog in
Avatar of donohara1
donohara1

asked on

how to create Totals for the same column for all sheets in an Excel workbook. VBA

I have Excel workbooks that have a variable number of sheets. I would like to sum the same column in each sheet, and create a table (in a new sheet) that has the sheet name, total and number of values in 3 columns. There is no other numeric data in these columns
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

If you are using Excel 2007 or 2010, I would simple create Tables for your various worksheets, and then in Table Tools/Design ribbon tab, select Total Row in the Table Style Options to force a grand total row.

Then, on another worksheet, use formulas to pull in the grand totals, such as:

=SUM(Table1[MyValueColumnName])
=SUM(Table2[MyValueColumnName])
=SUM(Table3[MyValueColumnName])
etc.

If you have the name of the table in, say, Col A, you can use:

=SUM(INDIRECT(A1&"[MyValueColumnName]"))
ASKER CERTIFIED SOLUTION
Avatar of m4trix
m4trix
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of donohara1
donohara1

ASKER

Perfect.