Thread: totals
View Single Post
  #4   Report Post  
mangesh_yadav
 
Posts: n/a
Default


Here's a small UDF wihch will help you sum the same cell in all the
sheets.

Function mySum(rng)
For Each Sht In Worksheets
mySum = mySum + Sht.Range(rng.Address)
Next
End Function


A small if statement will help you weed out unwanted sheets, for
instance, lets say you have a summary sheet, and don't want to include
this sheet, then you could modify the above udf to:

Function mySum(rng)
For Each sht In Worksheets
If sht.Name < "Summary" Then
mySum = mySum + sht.Range(rng.Address)
End If
Next
End Function


The UDF shold go in a standard module in VBE. Press Alt F11 to open
VBE. Insert Module. And enter the above code.

Usage:
=mysum(A1)
to summ A1 from all sheets.


Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=381509