Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default How do I reference the same cell in all previous sheets?

I want to refence a cell in all previous sheets in a workbook. The problem is
that I'd like to paste the formula to other sheets and still have it refernce
all previous sheets to that sheet.

For example, on sheet 5 the formula would refence cell A1 in sheets 1, 2, 3,
and 4. When I copy and paste the formula to a cell in sheet 9, I want it to
automatically expand the sheet range to now reference A1 in sheets 1, 2, 3,
4, 5, 6, 7, and 8.

Is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default How do I reference the same cell in all previous sheets?

Copy/paste this UDF 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

Example of usage...................

Say you have 12 sheets, sheet1 through sheet12...........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 Sun, 23 Nov 2008 19:39:00 -0800, Joe Lewis
wrote:

I want to refence a cell in all previous sheets in a workbook. The problem is
that I'd like to paste the formula to other sheets and still have it refernce
all previous sheets to that sheet.

For example, on sheet 5 the formula would refence cell A1 in sheets 1, 2, 3,
and 4. When I copy and paste the formula to a cell in sheet 9, I want it to
automatically expand the sheet range to now reference A1 in sheets 1, 2, 3,
4, 5, 6, 7, and 8.

Is this possible?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default How do I reference the same cell in all previous sheets?

Thank you so much. Will this only reference that cell for the previous
worksheet, or will it reference that cell on all worksheets previous to the
current one?

The reason I ask, is that I want to have a "year-to-date" statistics section
on each page that draws information from all previous worksheets to the
current one.

That way at the end of the year, I can go back through the pages and see the
year-to-date stats changing over time.



"Gord Dibben" wrote:

Copy/paste this UDF 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

Example of usage...................

Say you have 12 sheets, sheet1 through sheet12...........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 Sun, 23 Nov 2008 19:39:00 -0800, Joe Lewis
wrote:

I want to refence a cell in all previous sheets in a workbook. The problem is
that I'd like to paste the formula to other sheets and still have it refernce
all previous sheets to that sheet.

For example, on sheet 5 the formula would refence cell A1 in sheets 1, 2, 3,
and 4. When I copy and paste the formula to a cell in sheet 9, I want it to
automatically expand the sheet range to now reference A1 in sheets 1, 2, 3,
4, 5, 6, 7, and 8.

Is this possible?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default How do I reference the same cell in all previous sheets?

It will reference the cell on the previous sheet only.

But make it reference a cell on each previous sheet that accumulates from
sheet to sheet to sheet.


Gord

On Sun, 23 Nov 2008 21:08:01 -0800, Joe Lewis
wrote:

Thank you so much. Will this only reference that cell for the previous
worksheet, or will it reference that cell on all worksheets previous to the
current one?

The reason I ask, is that I want to have a "year-to-date" statistics section
on each page that draws information from all previous worksheets to the
current one.

That way at the end of the year, I can go back through the pages and see the
year-to-date stats changing over time.



"Gord Dibben" wrote:

Copy/paste this UDF 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

Example of usage...................

Say you have 12 sheets, sheet1 through sheet12...........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 Sun, 23 Nov 2008 19:39:00 -0800, Joe Lewis
wrote:

I want to refence a cell in all previous sheets in a workbook. The problem is
that I'd like to paste the formula to other sheets and still have it refernce
all previous sheets to that sheet.

For example, on sheet 5 the formula would refence cell A1 in sheets 1, 2, 3,
and 4. When I copy and paste the formula to a cell in sheet 9, I want it to
automatically expand the sheet range to now reference A1 in sheets 1, 2, 3,
4, 5, 6, 7, and 8.

Is this possible?




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
How can I reference a cell on a previous worksheet Kim Excel Discussion (Misc queries) 3 August 18th 08 12:10 PM
formula to reference cell on previous worksheet endless_thoughts17 Excel Worksheet Functions 2 January 25th 08 07:37 PM
reference to previous cell (always) Harvey Excel Discussion (Misc queries) 5 January 27th 07 12:02 AM
need formula to reference a cell in previous worksheet Jim Excel Worksheet Functions 3 January 5th 07 04:05 AM
Relative reference to a cell on a previous sheet [email protected] Excel Discussion (Misc queries) 1 July 17th 06 07:27 PM


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