I have a large workbook (150 sheets). In Sheet 1, Cell A1, I have the first
date (example: 01/01/06). I have Sheet 2, Cell A1 set to take the result of
Sheet 1, Cell A1 and add 1 to it to get 01/02/06, Sheet 3 adds 1 to sheet 2's
to get 01/03/06 and so on.
How can I set up the sheet tabs to automatically rename themselves when I
change the date in Sheet 1, Cell A1. I want it to change all the tabs
without having to go into each one and pressing enter or double-clicking them
to make the tabs change.
Is the tab name in any way based upon the date in A1? Remember that a tab
name cannot have a / in it.
--
Gary''s Studentquot;Chrisquot; wrote:
gt; I have a large workbook (150 sheets). In Sheet 1, Cell A1, I have the first
gt; date (example: 01/01/06). I have Sheet 2, Cell A1 set to take the result of
gt; Sheet 1, Cell A1 and add 1 to it to get 01/02/06, Sheet 3 adds 1 to sheet 2's
gt; to get 01/03/06 and so on.
gt;
gt; How can I set up the sheet tabs to automatically rename themselves when I
gt; change the date in Sheet 1, Cell A1. I want it to change all the tabs
gt; without having to go into each one and pressing enter or double-clicking them
gt; to make the tabs change.
Thanks. That works great. However, one last question. When I do the update
of the date and then run the macro, it pops up a message for each spreadsheet
that is to be changed. This is the situation.
Date format is 01/01/06. Same date type format for the rest of the sheets.
When I run the macro, it pops up with a pop-up message saying 1-1-2006 then
the OK button. When I select OK, it makes the first tab 1-1-2006, then pops
up with another one for the second sheet (1-2-2006), and continues for the
rest of the 150 sheets. Is there a code format that I can put into the macro
that will set it just like 01-01-06 without me a) getting it to require the
MM-DD-YYYY format and b) to prevent it from popping up the message popup
window for each spreadsheet?
quot;Gary''s Studentquot; wrote:
gt; Then we will use two steps, one in the worksheets and one in VBA:
gt;
gt;
gt; 1. In the worksheets, put any date in A1 of the first sheet
gt; In the second sheet in A1 put =Sheet1!A1 1
gt; Fill in A1 in each sheet in the same way
gt; Now each A1 is one day later than the previous and all will change if
gt; you change A1 in Sheet1
gt;
gt;
gt; 2. Enter the following macro:
gt; Sub fixtab()
gt; Dim w As Worksheet
gt; Dim s As String
gt; For Each w In ActiveWorkbook.Worksheets
gt; s = w.Cells(1, 1).Value
gt; s = Replace(s, quot;/quot;, quot;-quot;)
gt; MsgBox (s)
gt; w.Name = s
gt; Next w
gt; End Sub
gt;
gt; 3. First update the date in A1 in Sheet1 (all the other A1's will follow suit)
gt; Then run the macro.
gt; --
gt; Gary''s Student
gt;
gt;
gt; quot;Chrisquot; wrote:
gt;
gt; gt; Yes, the tab name is based on the date. Whereas the date displays in the
gt; gt; spreadsheet as 01/01/06 and then on word within the other spreadsheets by
gt; gt; adding one to the previous spreadsheet, it displays as 01-01-06 and so forth
gt; gt; in the tabs.
gt; gt;
gt; gt; quot;Gary''s Studentquot; wrote:
gt; gt;
gt; gt; gt; Is the tab name in any way based upon the date in A1? Remember that a tab
gt; gt; gt; name cannot have a / in it.
gt; gt; gt; --
gt; gt; gt; Gary''s Student
gt; gt; gt;
gt; gt; gt;
gt; gt; gt; quot;Chrisquot; wrote:
gt; gt; gt;
gt; gt; gt; gt; I have a large workbook (150 sheets). In Sheet 1, Cell A1, I have the first
gt; gt; gt; gt; date (example: 01/01/06). I have Sheet 2, Cell A1 set to take the result of
gt; gt; gt; gt; Sheet 1, Cell A1 and add 1 to it to get 01/02/06, Sheet 3 adds 1 to sheet 2's
gt; gt; gt; gt; to get 01/03/06 and so on.
gt; gt; gt; gt;
gt; gt; gt; gt; How can I set up the sheet tabs to automatically rename themselves when I
gt; gt; gt; gt; change the date in Sheet 1, Cell A1. I want it to change all the tabs
gt; gt; gt; gt; without having to go into each one and pressing enter or double-clicking them
gt; gt; gt; gt; to make the tabs change.
- Jun 22 Fri 2007 20:38
Setting Tab Names To Dates In Spreadsheet
close
全站熱搜
留言列表
發表留言