Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Add values of cell H1000 in every sheet.

Hi,

I need to add together the values of cell H1000 in every sheet in the
workbook.
The trouble is each day there might be a different number of sheets.

Ideally the total value would be returned as a variable so that I can
use it deeper
in for a further calculation, which I just about can manage!

Would be grateful for any help/pointers any kind soul can offer.

Thanks,

Stuart

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Add values of cell H1000 in every sheet.

One way:

Put a blank worksheet named First before the sheets you want to add, and
a blank worksheet name Last after the last sheet you want to add. Then
use

=SUM(First:Last!H1000)

Make sure any added sheets fall between First and Last.

Or, if you want a programming solution, perhaps something like this User
Defined Function:

Public Function SumOfAllSheets(ByVal rRef As Range) As Variant
Dim ws As Worksheet
Dim dTemp As Double
Dim sAddress
Application.Volatile
On Error GoTo ErrHandler
sAddress = rRef.Address
If sAddress = Application.Caller.Address Then
SumOfAllSheets = CVErr(xlErrRef)
Else
For Each ws In Application.Caller.Parent.Parent.Worksheets
dTemp = dTemp + ws.Range(sAddress)
Next ws
SumOfAllSheets = dTemp
End If
Exit Function
ErrHandler:
SumOfAllSheets = CVErr(xlErrValue)
End Function


In article . com,
"Krayten" wrote:

Hi,

I need to add together the values of cell H1000 in every sheet in the
workbook.
The trouble is each day there might be a different number of sheets.

Ideally the total value would be returned as a variable so that I can
use it deeper
in for a further calculation, which I just about can manage!

Would be grateful for any help/pointers any kind soul can offer.

Thanks,

Stuart

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Add values of cell H1000 in every sheet.

You can do that without resorting to VBA. Add a sheet at the front of the
workbook called Start and one at the end of the book called End. Hide these
two sheets. Now you just need to add a formula like...

=SUM(Start:End!H1000)

With start and end hidden any sheets added or deleted will be between these
two sheets and the formula will return the correct value...
--
HTH...

Jim Thomlinson


"Krayten" wrote:

Hi,

I need to add together the values of cell H1000 in every sheet in the
workbook.
The trouble is each day there might be a different number of sheets.

Ideally the total value would be returned as a variable so that I can
use it deeper
in for a further calculation, which I just about can manage!

Would be grateful for any help/pointers any kind soul can offer.

Thanks,

Stuart


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Add values of cell H1000 in every sheet.

Jim, this worked perfectly, though the new hidden sheets don't show up
in the excel object explorer with the older sheet
between them as I expected the values obtained in the testing I've
just completed certainly adds up correctly.

Thanks you for this simple way to solve the problem.

Kind regards,

Stuart

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
Copying values from one sheet to the same cell in another sheet Ayo Excel Discussion (Misc queries) 2 September 19th 08 06:21 PM
copy values generated by conditional formula in one sheet to the other work sheet as values ramana Excel Worksheet Functions 1 October 5th 05 01:04 PM
copy values generated by conditional formula in one sheet to the other work sheet as values bobby Excel Discussion (Misc queries) 1 October 5th 05 12:18 PM
Cell linked to a range of cell values in different sheet szeng Excel Discussion (Misc queries) 1 August 9th 05 02:41 AM
Assign values to a cell in sheet A, from worksheet_change event of sheet B Arif Khan Excel Programming 1 May 4th 04 04:51 AM


All times are GMT +1. The time now is 08:59 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"