Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default running-total formulas written from one spreadsheet to another

Is there a way to automatically transfer running-total formulas written from
one spreadsheet to another, that automatically updates the worksheet formulas
from the previous sheet to the next? For example, if sheet 2 has reference
formulas (running totals) that carry from sheet 1, can I start sheet 3 to
automatically inherit the same formulas but automatically reference to sheet
2, that referenced a running total from sheet 1, without having to go through
each cell and rewrite the formula to correspond to the current page (sheet 3)
and previous page (sheet 2)? I hope I've explained this clearly. I am
working on spreadsheets that have numerous, running-total formulas and it
would be a pain to have to go through and rewrite each one.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default running-total formulas written from one spreadsheet to another

Neumeister

Copy/paste this User Defined Function to a general module in your workbook.

Function PrevSheet(rg As Range)
N = Application.Caller.Parent.Index
If N = 1 Then
PrevSheet = CVErr(xlErrRef)
ElseIf TypeName(Sheets(N - 1)) = "Chart" Then
PrevSheet = CVErr(xlErrNA)
Else
PrevSheet = Sheets(N - 1).Range(rg.Address).Value
End If
End Function

'Enter =PrevSheet(B2) on sheet2 and you'll get B2 from sheet1.

Tip.......you can group several sheets and enter the formula in first sheet
and all sheets will have the formula entered, referring to its previous sheet.

If not familiar with VBA and macros see David McRitchie's site.

http://www.mvps.org/dmcritchie/excel/getstarted.htm

Gord Dibben Excel MVP

On Wed, 8 Dec 2004 13:33:04 -0800, "Neumeister"
wrote:

Is there a way to automatically transfer running-total formulas written from
one spreadsheet to another, that automatically updates the worksheet formulas
from the previous sheet to the next? For example, if sheet 2 has reference
formulas (running totals) that carry from sheet 1, can I start sheet 3 to
automatically inherit the same formulas but automatically reference to sheet
2, that referenced a running total from sheet 1, without having to go through
each cell and rewrite the formula to correspond to the current page (sheet 3)
and previous page (sheet 2)? I hope I've explained this clearly. I am
working on spreadsheets that have numerous, running-total formulas and it
would be a pain to have to go through and rewrite each one.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default running-total formulas written from one spreadsheet to another

Thank you, but what is, exactly, "a general module?" I'm not clear on where
to paste your info below.

"Gord Dibben" wrote:

Neumeister

Copy/paste this User Defined Function to a general module in your workbook.

Function PrevSheet(rg As Range)
N = Application.Caller.Parent.Index
If N = 1 Then
PrevSheet = CVErr(xlErrRef)
ElseIf TypeName(Sheets(N - 1)) = "Chart" Then
PrevSheet = CVErr(xlErrNA)
Else
PrevSheet = Sheets(N - 1).Range(rg.Address).Value
End If
End Function

'Enter =PrevSheet(B2) on sheet2 and you'll get B2 from sheet1.

Tip.......you can group several sheets and enter the formula in first sheet
and all sheets will have the formula entered, referring to its previous sheet.

If not familiar with VBA and macros see David McRitchie's site.

http://www.mvps.org/dmcritchie/excel/getstarted.htm

Gord Dibben Excel MVP

On Wed, 8 Dec 2004 13:33:04 -0800, "Neumeister"
wrote:

Is there a way to automatically transfer running-total formulas written from
one spreadsheet to another, that automatically updates the worksheet formulas
from the previous sheet to the next? For example, if sheet 2 has reference
formulas (running totals) that carry from sheet 1, can I start sheet 3 to
automatically inherit the same formulas but automatically reference to sheet
2, that referenced a running total from sheet 1, without having to go through
each cell and rewrite the formula to correspond to the current page (sheet 3)
and previous page (sheet 2)? I hope I've explained this clearly. I am
working on spreadsheets that have numerous, running-total formulas and it
would be a pain to have to go through and rewrite each one.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default running-total formulas written from one spreadsheet to another

There are code modules that belong to worksheets, ThisWorkbook, class modules
and some that are for general use.


Open your workbook then
hit alt-f11 to get to the VBE (where the macros live)
then hit ctrl-r to see the project explorer
then select your project
then Insert|module
and paste Gord's code there.

Then back to excel (alt-f11 again) and test it out.



reds&bengals wrote:

Thank you, but what is, exactly, "a general module?" I'm not clear on where
to paste your info below.

"Gord Dibben" wrote:

Neumeister

Copy/paste this User Defined Function to a general module in your workbook.

Function PrevSheet(rg As Range)
N = Application.Caller.Parent.Index
If N = 1 Then
PrevSheet = CVErr(xlErrRef)
ElseIf TypeName(Sheets(N - 1)) = "Chart" Then
PrevSheet = CVErr(xlErrNA)
Else
PrevSheet = Sheets(N - 1).Range(rg.Address).Value
End If
End Function

'Enter =PrevSheet(B2) on sheet2 and you'll get B2 from sheet1.

Tip.......you can group several sheets and enter the formula in first sheet
and all sheets will have the formula entered, referring to its previous sheet.

If not familiar with VBA and macros see David McRitchie's site.

http://www.mvps.org/dmcritchie/excel/getstarted.htm

Gord Dibben Excel MVP

On Wed, 8 Dec 2004 13:33:04 -0800, "Neumeister"
wrote:

Is there a way to automatically transfer running-total formulas written from
one spreadsheet to another, that automatically updates the worksheet formulas
from the previous sheet to the next? For example, if sheet 2 has reference
formulas (running totals) that carry from sheet 1, can I start sheet 3 to
automatically inherit the same formulas but automatically reference to sheet
2, that referenced a running total from sheet 1, without having to go through
each cell and rewrite the formula to correspond to the current page (sheet 3)
and previous page (sheet 2)? I hope I've explained this clearly. I am
working on spreadsheets that have numerous, running-total formulas and it
would be a pain to have to go through and rewrite each one.




--

Dave Peterson
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
Over-written formulas dcornett63 Excel Discussion (Misc queries) 2 October 15th 09 04:09 PM
How do I input these formulas into cells that I want written in? Paige Excel Worksheet Functions 4 December 31st 08 03:44 AM
Duplicate Running Total Grand Total In Pivot Table Mathew P Bennett[_2_] Excel Discussion (Misc queries) 1 August 17th 08 03:13 AM
pivot table formulas - running total Wade Lau Excel Discussion (Misc queries) 0 March 13th 07 08:01 PM
Keeping formulas on running total and sorts LoriM1 Excel Worksheet Functions 0 April 19th 06 02:58 PM


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