Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Carrying formulas from one sheet to the next within the same file

I have 52 tabs set up, one for each week of the year. I enter data in the
top of my grid on one sheet and I want it to add it to the cumulative total
below. Each week I want to copy and paste the grid with formulas to the next
week (worksheet) but it is not carrying over the formulas. I have the name
of the referenced sheet in quotes in the formula. How do I overcome this so
I do not have to plug in the formulas every week? Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Carrying formulas from one sheet to the next within the same file

If you're willing to use a User Defined Function.......

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

Say you have 52 sheets, sheet1 through sheet52...........sheet names don't
matter.

In sheet1 you have a formula in A10 =SUM(A1:A9)

Select second sheet and SHIFT + Click last sheet

In active sheet A10 enter =SUM(PrevSheet(A10),A1:A9)

Ungroup the sheets.

Each A10 will have the sum of the previous sheet's A10 plus the sum of the
current sheet's A1:A9


Gord Dibben MS Excel MVP


On Mon, 19 Nov 2007 10:37:01 -0800, mrudnet
wrote:

I have 52 tabs set up, one for each week of the year. I enter data in the
top of my grid on one sheet and I want it to add it to the cumulative total
below. Each week I want to copy and paste the grid with formulas to the next
week (worksheet) but it is not carrying over the formulas. I have the name
of the referenced sheet in quotes in the formula. How do I overcome this so
I do not have to plug in the formulas every week? Thanks in advance.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Carrying formulas from one sheet to the next within the same file

Or, if you want to ignore Chart sheets:

Public Function PrevWorksheet(ByRef rng As Range) As Variant
Dim n As Long
Dim sName As String
Application.Volatile
With Application.Caller.Parent
sName = .Name
With .Parent.Worksheets
For n = 1 To .Count - 1
If .Item(n).Name = sName Then Exit For
Next n
If n = 1 Then
PrevWorksheet = CVErr(xlErrRef)
Else
PrevWorksheet = .Item(n - 1).Range(rng.Address).Value
End If
End With
End With
End Function


In article ,
Gord Dibben <gorddibbATshawDOTca wrote:

If you're willing to use a User Defined Function.......

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

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
Carrying over formulas into newly inserted row Riphay Excel Discussion (Misc queries) 2 August 8th 07 03:02 AM
Carrying format with cell reference to another sheet. [email protected] Charts and Charting in Excel 1 June 2nd 07 07:43 PM
carrying over a column formula from one sheet to another copied sh Carl Excel Worksheet Functions 3 June 6th 06 01:31 AM
carrying entire row to another sheet using vlookup [email protected] Excel Discussion (Misc queries) 0 June 1st 05 01:23 PM
Moving a file without carrying over permissions StuThomson Excel Discussion (Misc queries) 1 December 29th 04 03:27 PM


All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"