VBA Sum all worsksheets in column T

Weeble

Board Regular
Joined
Nov 30, 2016
Messages
95
Office Version
  1. 365
Heya !

I have a pretty big excel file with aprox 60 worksheets. In every sheet column T has aprox 1000-4000 rows of data.
How would be the easiest way to summarise this data into a "summary-sheet" ?
There is alot of blank spaces in column T aswell if that might be an issue?
 
if you want a macro for naming the sheet the below will work fine

Code:
Sub name_shts()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
ActiveCell.Value = sh.Name
ActiveCell.Offset(1, 0).Activate
Next sh
End Sub
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
it will list the sheets and then you can just add the named range.

if you want a macro for naming the sheet the below will work fine

Code:
Sub name_shts()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
ActiveCell.Value = sh.Name
ActiveCell.Offset(1, 0).Activate
Next sh
End Sub
 
Upvote 0
Here is a UDF (user defined function) that should give you that total...
Code:
Function TotalColT() As Double
  Dim WS As Worksheet
  For Each WS In ThisWorkbook.Worksheets
    TotalColT = TotalColT + Application.Sum(WS.Range("T:T"))
  Next
End Function
Thx Rick! How do I make it paste to a location of my choice ? Sorry I am new to VBA :)
 
Upvote 0
Here is a UDF (user defined function) that should give you that total...
Code:
Function TotalColT() As Double
  Dim WS As Worksheet
  For Each WS In ThisWorkbook.Worksheets
    TotalColT = TotalColT + Application.Sum(WS.Range("T:T"))
  Next
End Function
Thx Rick! How do I make it paste to a location of my choice ? Sorry I am new to VBA :)
I had hoped my "HOW TO INSTALL UDFs" would have made that clear. After installing the code, simply put this formula in whatever cell you want the total to show in...

=TotalColT()
 
Last edited:
Upvote 0
Before the OP does that, he may want to look at Message #10.

Nice, definitely less hassle. Maybe he might want it to be volatile.

Weeble, If that the case just add Application.Volatile in at the start.
 
Upvote 0
Rick , Sorry I missed it ! But wow, that worked above my expectations, thx alot for this.

Thx BarryL for clearing it up aswell :)
 
Upvote 0
A much better solution (provided you can trust your users not to rearrange the sheet tabs on you:wink:).

You're right.

I use the usual solution of adding one worksheet before and one after the group of worksheets in the formula. I name them Start and End and then use

=SUM(Start:End!T:T)

This way I can insert, delete or move worksheets as long and they remain between Start and End and the formula will always work.
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,378
Members
448,955
Latest member
BatCoder

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