Increment Sheet #

McAllan

New Member
Joined
Aug 4, 2010
Messages
19
Hi All.
I have a report which I require every Monday. My Sheet (Tab) name is the Week number of the year. If I Move/Copy this weeks sheet, I always get the same sheet # (2). Is there any way to increment this to Week 14, Week 15 etc.
The main reason for this would be to make sure the date (heading) for the sheet will update automatically. If I try to use cell A1 in Sheet (Week 14) as a relative ref in Sheet 15, it will not update as it appears to use an abs ref.
I dont do well with VBA (yet).
Thanks in advance.
McAllan
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
If I try to use cell A1 in Sheet (Week 14) as a relative ref in Sheet 15, it will not update as it appears to use an abs ref.

Can you explain this part? You have two sheets (week 14 & 15) and you want to reference in week 15 items from week 14 sheet?
 
Upvote 0
Yes. In cell A1 of Sheet1, I have a date. In A1 of Sheet2 I have =Sheet1!A1+7. If I try to copy this to Sheet3 & Sheet4 etc etc, =Sheet1!A1+7 is what gets copied through. It seems to me as if you cannot get a relative reference to another Sheet like you can with another cell in the same sheet ($A$1, $A1 or A$1) or am I missing something.
Thanks for your reply.
 
Upvote 0
so I'm not understanding, but let me ask you like this, you have
Excel Workbook
A
19
Sheet2

Excel 2003
Cell Formulas
RangeFormula
A1=Sheet1!A1+7

the formula on this sheet(=Sheet1!A1+7) and you want to copy it but have the sheet number increment? So now on the new sheet it would be
=Sheet2!A1+7

have I got it?
 
Upvote 0
Thats it. I am using Excel 2007. I dont want to have to go to each new sheet and manually change it to say =Sheet2!A1 and then =Sheet3!A1 etc.
 
Upvote 0
ok so this is ugly but should work
HTML:
=INDIRECT(MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1))-1)
    &RIGHT(MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1))),1)-1
     &"!A1")
 
Upvote 0
It might look ugly but something sure happens. If I enter it directly, I get a REF# error. If I remove the INDIRECT, I get Week2!A1.
I have got something to start with here. Thanks a million.
It is rather late here 23h45 so I will catch any reply tomorrow. Thanks again.
 
Upvote 0
Yes. In cell A1 of Sheet1, I have a date. In A1 of Sheet2 I have =Sheet1!A1+7. If I try to copy this to Sheet3 & Sheet4 etc etc, =Sheet1!A1+7 is what gets copied through. It seems to me as if you cannot get a relative reference to another Sheet like you can with another cell in the same sheet ($A$1, $A1 or A$1) or am I missing something.
Thanks for your reply.

The following macro will
- add a new worksheet
- set the "A1" value of that worksheet to the last worksheet's date plus 7 days


Code:
Sub relativedate()
'
' relativedate Macro
'
Dim i As Integer
Dim d As Date

Sheets.Add After:=Sheets(Sheets.Count)
i = Worksheets(Worksheets.Count).Range("A1").Parent.Index
d = Worksheets(i - 1).Range("A1").Value
Worksheets(Worksheets.Count).Cells(1, 1) = d + 7

End Sub
 
Upvote 0
May be try something like this;

If your tab names are Week 1, Week 2, week 3......

Define a name PrevWeekValue

referes to:

=INDIRECT("'Week "&SUBSTITUTE(UPPER(REPLACE(CELL("filename",!$A$1),1,FIND("]",CELL("filename",!$A$1)),"")),"WEEK","")-1&"'!A1")+7

If you don't have a space in the sheet name, remove the space after the"'Week ".

Select A1 in the sheets enter

=PrevWeekValue
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top