Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Totalling sequential worksheets

I want to set up a generic formula that automatically looks for a particular
cell in the previous worksheet & adds 1 to the value. When I copy & paste the
formula, it copies exactly, instead up updating to the previous worksheet,
even when I try copying only the formatting or formula.

Example:
In worksheet January 13, 2008, the formula is: =SUM('Dec 9, 2008'!M2+1) &
the value is 7
In the worksheet February 10, the formula is: =SUM('Jan 13, 2008'!M2+1) and
the value is 8
When I create the new worksheet March 10, 2009, I copy the cell from the
February worksheet & paste it into the March work sheet, it comes out as:
=SUM('Jan 13, 2008'!M2+1) with a value of 8
I want it to come out as: =SUM('Feb 10, 2009'!M2+1) with a value of 9.

And so on.... so each total value in cell M2 gets greater in increments of
1, & that it calculates it without me having to create the formula for that
cell each time - because there are approximately 25 cells in each worksheet
that need to be updated in this way.
Anybody got a clue? Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,104
Default Totalling sequential worksheets

This subroutine is copied from
http://www.exceltip.com/st/Add_value...Excel/516.html


Function SumPreviousSheet(InputRange As Range) As Double
' adds the values in InputRange in the previous worksheet
' returns 0 if the function is used in the first worksheet
Application.Volatile ' omit if not necessary
SumPreviousSheet = 0
On Error Resume Next
SumPreviousSheet = _
Application.WorksheetFunction.Sum(InputRange.Paren t.Previous.Range(InputRange.Address))
On Error GoTo 0
End Function

Use is like this =SumPreviousSheet(M2)+1

New to VBA?
VBA intro
Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm


By the way: you do mot need SUM when you are just adding two values
So =SUM('Dec 9, 2008'!M2 + 1) can be written as ='Dec 9, 2008'!M2 + 1
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"KErin" wrote in message
...
I want to set up a generic formula that automatically looks for a
particular
cell in the previous worksheet & adds 1 to the value. When I copy & paste
the
formula, it copies exactly, instead up updating to the previous worksheet,
even when I try copying only the formatting or formula.

Example:
In worksheet January 13, 2008, the formula is: =SUM('Dec 9, 2008'!M2+1) &
the value is 7
In the worksheet February 10, the formula is: =SUM('Jan 13, 2008'!M2+1)
and
the value is 8
When I create the new worksheet March 10, 2009, I copy the cell from the
February worksheet & paste it into the March work sheet, it comes out as:
=SUM('Jan 13, 2008'!M2+1) with a value of 8
I want it to come out as: =SUM('Feb 10, 2009'!M2+1) with a value of 9.

And so on.... so each total value in cell M2 gets greater in increments of
1, & that it calculates it without me having to create the formula for
that
cell each time - because there are approximately 25 cells in each
worksheet
that need to be updated in this way.
Anybody got a clue? Thanks!



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
Totalling Values From The Same Cell In 12 Worksheets Onto New Shee Gatsby Excel Worksheet Functions 4 January 11th 07 02:04 AM
Totalling a group of worksheets BJ Excel Discussion (Misc queries) 3 December 14th 05 07:00 PM
Totalling Criteria from Muliple Worksheets Overworked&Underpaid Excel Discussion (Misc queries) 1 August 25th 05 08:14 PM
Transfering and totalling corresponding data to other worksheets Heatherbelle89 Excel Discussion (Misc queries) 2 July 12th 05 08:57 AM
Totalling Separate Worksheets huskggie Excel Worksheet Functions 1 November 15th 04 03:20 AM


All times are GMT +1. The time now is 09:46 PM.

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"