Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
igor
 
Posts: n/a
Default grand total column B from every worksheet in workbook

I want to have a function in a cell that totals column B from every
worksheet in my workbook even w/o knowing how many worksheets there are or
what the name of any worksheet is.

Even better, because I would like to have a "summary" worksheet, the
function should skip column B in its own work sheet -- so, the function I'd
like might total every number in a column called "Qty" for any worksheet in
the workbook that has a column named "Qty".

I have an Excel doc that holds all of my sales data. The data is imported
as a text file from a webstore db into a worksheet named for the current
month - e.g., 05Jan. Every worksheet is based on a template, with each
column labeled. I'd like a summary sheet that would keep a running total
of sales quantity (every column labeled "Qty") -- i.e., how many units have
been sold since Day 1.

Suggestions would be appreciated. TIA. -- Igor
  #2   Report Post  
Jason Morin
 
Posts: n/a
Default

To sum column B of every worksheet except the current
one, you could use:

Function SumColumnB() As Long
Dim ws As Worksheet
Dim TotalQty As Long
Dim SheetQty As Long
Dim ActiveWSQty As Long
Application.Volatile
ActiveWSQty = Application.Sum(ActiveSheet.[B:B])
For Each ws In ThisWorkbook.Worksheets
SheetQty = Application.Sum(ws.[B:B])
TotalQty = TotalQty + SheetQty
Next
SumColumnB = TotalQty - ActiveWSQty
End Function

--
To use, press ALT+F11, go to Insert Module, and paste
in the code above. Press ALT+Q to close the window. Call
the function in the worksheet as:

=SumColumnB()

HTH
Jason
Atlanta, GA

-----Original Message-----
I want to have a function in a cell that totals column B

from every
worksheet in my workbook even w/o knowing how many

worksheets there are or
what the name of any worksheet is.

Even better, because I would like to have a "summary"

worksheet, the
function should skip column B in its own work sheet --

so, the function I'd
like might total every number in a column called "Qty"

for any worksheet in
the workbook that has a column named "Qty".

I have an Excel doc that holds all of my sales data.

The data is imported
as a text file from a webstore db into a worksheet named

for the current
month - e.g., 05Jan. Every worksheet is based on a

template, with each
column labeled. I'd like a summary sheet that would

keep a running total
of sales quantity (every column labeled "Qty") -- i.e.,

how many units have
been sold since Day 1.

Suggestions would be appreciated. TIA. -- Igor
.

  #3   Report Post  
igor
 
Posts: n/a
Default

On Wed, 23 Feb 2005 08:43:46 -0800, "Jason Morin"
wrote:

To sum column B of every worksheet except the current
one, you could use:

Function SumColumnB() As Long
Dim ws As Worksheet
Dim TotalQty As Long
Dim SheetQty As Long
Dim ActiveWSQty As Long
Application.Volatile
ActiveWSQty = Application.Sum(ActiveSheet.[B:B])
For Each ws In ThisWorkbook.Worksheets
SheetQty = Application.Sum(ws.[B:B])
TotalQty = TotalQty + SheetQty
Next
SumColumnB = TotalQty - ActiveWSQty
End Function



Wow, that's perfect. I did have to learn that I have to manually update
the cell to be sure that it is current as I switch between worksheets. But
after that, works fine. Thanks, Jason. -- Igor
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy a column in worksheet with a character change photowiz Excel Worksheet Functions 1 February 5th 05 03:35 PM
Update second worksheet with changes in original worksheet ZB Excel Worksheet Functions 0 January 26th 05 06:11 PM
How do I ROUNDUP a Column of cells on a worksheet template? house mouse Excel Worksheet Functions 2 December 16th 04 06:49 PM
how to copy 2350 hyperlink full paths to any column in a worksheet ? kontiki Excel Discussion (Misc queries) 4 December 10th 04 10:00 PM
Seach Column and return multiple dates to another worksheet? Mcasteel Excel Worksheet Functions 0 November 10th 04 07:41 PM


All times are GMT +1. The time now is 02:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"