ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Compile numbers from multiple worksheets (https://www.excelbanter.com/excel-worksheet-functions/22271-compile-numbers-multiple-worksheets.html)

jjneedshelp

Compile numbers from multiple worksheets
 
I have a workbook with over 100 worksheets in it. I need to be able to total
numbers from specific cells on all pages into my cover page. Can someone
help?

Bob Phillips

Something like

=SUM(Sheet2:Sheet100!A1)

and so forth?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"jjneedshelp" wrote in message
...
I have a workbook with over 100 worksheets in it. I need to be able to

total
numbers from specific cells on all pages into my cover page. Can someone
help?




Fadi Chalouhi

Create a user-defined function SheetSum that loops through the sheets
and sums the relavant ranges. here's the code :

Function SheetSum(ByVal InData As Range) As Variant
Dim wsCurrent As Worksheet
Dim CurSum As Double

CurSum = 0
For Each wsCurrent In Worksheets
CurSum = CurSum + wsCurrent.Range(InData.Address).Value
Next wsCurrent
SheetSum = CurSum
End Function

to call this function to add , for example, the contents of range A2 in
all sheets, enter this formula = SheetSum(A2).

HTH

Fadi
www.chalouhis.com/XLBLOG



All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com