ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy date formula to multiple sheets (https://www.excelbanter.com/excel-discussion-misc-queries/119852-copy-date-formula-multiple-sheets.html)

John

Copy date formula to multiple sheets
 
I am trying to setup a workbook with 52 sheets (1 per week). I put 11/18/06
in sheet1!a1, then goto sheet2!a1 and enter the formula +sheet1!a1+7. The
result is 11/25/06. But when I copy sheet2!a1 to sheet3!a1, the result is
still 11/25/06, it should be 12/02/06.
--
John

David Biddulph

Copy date formula to multiple sheets
 
If your formula in sheet 3 is saying sheet1!a1+7, that will still be
11/25/06.
--
David Biddulph

"John" wrote in message
...
I am trying to setup a workbook with 52 sheets (1 per week). I put
11/18/06
in sheet1!a1, then goto sheet2!a1 and enter the formula +sheet1!a1+7. The
result is 11/25/06. But when I copy sheet2!a1 to sheet3!a1, the result is
still 11/25/06, it should be 12/02/06.
--
John




Gord Dibben

Copy date formula to multiple sheets
 
John

You can ease your task considerably if you employ a User Defined Function.

Function PrevSheet(rg As Range)
Application.Volatile
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

Copy/paste this to a General Module in your workbook.

In sheet1 A1 enter a date.

Select sheet2 then SHIFT + Click on sheet52.

In A1 of sheet2 enter =PrevSheet(A1) + 7

Select sheet1 again to ungroup the sheets.


Gord Dibben MS Excel MVP

On Wed, 22 Nov 2006 13:29:01 -0800, John wrote:

I am trying to setup a workbook with 52 sheets (1 per week). I put 11/18/06
in sheet1!a1, then goto sheet2!a1 and enter the formula +sheet1!a1+7. The
result is 11/25/06. But when I copy sheet2!a1 to sheet3!a1, the result is
still 11/25/06, it should be 12/02/06.




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com