Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Adrian
 
Posts: n/a
Default How can I get excel to label sheets automatically? eg: dates.

I want Excel to label my sheets automatically, because I make a workbook
every month and I don't feel like entering every date on every tab. Is this
possible?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default How can I get excel to label sheets automatically? eg: dates.

Do you need a dated tab name for every day of each month?

  #3   Report Post  
Posted to microsoft.public.excel.misc
Adrian
 
Posts: n/a
Default How can I get excel to label sheets automatically? eg: dates.

Yes that is exactly what I need.

"Dave O" wrote:

Do you need a dated tab name for every day of each month?


  #4   Report Post  
Posted to microsoft.public.excel.misc
DCSwearingen
 
Posts: n/a
Default How can I get excel to label sheets automatically? eg: dates.


I have a very similar situation. I have a new workbook for every month
and a worksheet in that workbook for every day of the month.

My solution is not very elegant:
I created a workbook,

Deleted all but one sheet,

Did the formatting I want for every day in that first sheet. Headers,
number formats, etc.

Copied the sheet 30 more times

Numbered each sheet 01, 02, ... , 30, & 31

Then save the sheet as an original or as a template. Template is best
so you don't screw up you orignal as easily.

Then just use that one to copy for each month.

A simple macro could also be created to insert and name new sheets in
consecutive order if the formatting & headers are not as critical.


--
DCSwearingen


------------------------------------------------------------------------
DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506
View this thread: http://www.excelforum.com/showthread...hreadid=542592

  #5   Report Post  
Posted to microsoft.public.excel.misc
Adrian
 
Posts: n/a
Default How can I get excel to label sheets automatically? eg: dates.

yes I do!

"Adrian" wrote:

Yes that is exactly what I need.

"Dave O" wrote:

Do you need a dated tab name for every day of each month?




  #6   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default How can I get excel to label sheets automatically? eg: dates.

Start a new workbook
Add this code to a general module in that workbook's project

Option Explicit
Sub testme()
Dim iCtr As Long
Dim NewWkbk As Workbook
Dim HowMany As Long
Dim StartDate As Date

StartDate = DateSerial(Year(Date), Month(Date) + 1, 1)
StartDate = Application.InputBox(prompt:="Enter a date in the month you
want", _
Type:=1, Default:=Format(StartDate, "mmmm dd, yyyy"))

If Year(StartDate) < 2005 _
Or Year(StartDate) 2010 Then
Exit Sub
End If

StartDate = DateSerial(Year(StartDate), Month(StartDate), 1) 'First of the
month!
HowMany = Day(DateSerial(Year(StartDate), Month(StartDate) + 1, 0))

Set NewWkbk = Workbooks.Add(1) 'single sheet
NewWkbk.Sheets.Add Count:=HowMany - 1

For iCtr = 1 To HowMany
NewWkbk.Worksheets(iCtr).Name _
= Format(StartDate - 1 + iCtr, "yyyy_mm_dd")
Next iCtr

End Sub

Back to excel
put a giant button from the Forms toolbar on the first worksheet in that new
workbook. Assign this macro to the button.

Save this workbook.

Open the workbook when you want to create a new workbook for the month and click
the giant button.

Adrian wrote:

I want Excel to label my sheets automatically, because I make a workbook
every month and I don't feel like entering every date on every tab. Is this
possible?


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default How can I get excel to label sheets automatically? eg: dates.

No real change--just fixing line wrapping!

Option Explicit
Sub testme()
Dim iCtr As Long
Dim NewWkbk As Workbook
Dim HowMany As Long
Dim StartDate As Date

StartDate = DateSerial(Year(Date), Month(Date) + 1, 1)
StartDate = Application.InputBox _
(prompt:="Enter a date in the month you want", _
Type:=1, Default:=Format(StartDate, "mmmm dd, yyyy"))

If Year(StartDate) < 2005 _
Or Year(StartDate) 2010 Then
Exit Sub
End If
'First of the month!
StartDate = DateSerial(Year(StartDate), Month(StartDate), 1)
HowMany = Day(DateSerial(Year(StartDate), Month(StartDate) + 1, 0))

Set NewWkbk = Workbooks.Add(1) 'single sheet
NewWkbk.Sheets.Add Count:=HowMany - 1

For iCtr = 1 To HowMany
NewWkbk.Worksheets(iCtr).Name _
= Format(StartDate - 1 + iCtr, "yyyy_mm_dd")
Next iCtr

End Sub


Dave Peterson wrote:

Start a new workbook
Add this code to a general module in that workbook's project

<<snipped

Back to excel
put a giant button from the Forms toolbar on the first worksheet in that new
workbook. Assign this macro to the button.

Save this workbook.

Open the workbook when you want to create a new workbook for the month and click
the giant button.

Adrian wrote:

I want Excel to label my sheets automatically, because I make a workbook
every month and I don't feel like entering every date on every tab. Is this
possible?


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.misc
Adrian
 
Posts: n/a
Default How can I get excel to label sheets automatically? eg: dates.

Thank you very much!!!!!!

"Dave Peterson" wrote:

Start a new workbook
Add this code to a general module in that workbook's project

Option Explicit
Sub testme()
Dim iCtr As Long
Dim NewWkbk As Workbook
Dim HowMany As Long
Dim StartDate As Date

StartDate = DateSerial(Year(Date), Month(Date) + 1, 1)
StartDate = Application.InputBox(prompt:="Enter a date in the month you
want", _
Type:=1, Default:=Format(StartDate, "mmmm dd, yyyy"))

If Year(StartDate) < 2005 _
Or Year(StartDate) 2010 Then
Exit Sub
End If

StartDate = DateSerial(Year(StartDate), Month(StartDate), 1) 'First of the
month!
HowMany = Day(DateSerial(Year(StartDate), Month(StartDate) + 1, 0))

Set NewWkbk = Workbooks.Add(1) 'single sheet
NewWkbk.Sheets.Add Count:=HowMany - 1

For iCtr = 1 To HowMany
NewWkbk.Worksheets(iCtr).Name _
= Format(StartDate - 1 + iCtr, "yyyy_mm_dd")
Next iCtr

End Sub

Back to excel
put a giant button from the Forms toolbar on the first worksheet in that new
workbook. Assign this macro to the button.

Save this workbook.

Open the workbook when you want to create a new workbook for the month and click
the giant button.

Adrian wrote:

I want Excel to label my sheets automatically, because I make a workbook
every month and I don't feel like entering every date on every tab. Is this
possible?


--

Dave Peterson

  #9   Report Post  
Posted to microsoft.public.excel.misc
DCSwearingen
 
Posts: n/a
Default How can I get excel to label sheets automatically? eg: dates.


Many Thanks to Dave Peterson!!

In my earlier, not so elegant way of doing this, I wanted to maintain
my report formatting.

I copied that formatting to the the worksheet with the macro button and
saved my workbook with this macro as "Add_CR_Workbook.xls" and added the
following to the end of Dave code:

Windows("Add_CR_Workbook.xls").Activate
Cells.Copy

Windows(NewWkBkName).Activate
For iCtr = 1 To Worksheets.Count
Sheets(iCtr).Select
Cells.PasteSpecial Paste:=xlFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Next iCtr


--
DCSwearingen


------------------------------------------------------------------------
DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506
View this thread: http://www.excelforum.com/showthread...hreadid=542592

  #10   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default How can I get excel to label sheets automatically? eg: dates.

Glad you got your variation working.

Another way to do this would be to do that formatting to the first worksheet.
Then copy that first worksheet lots of times (instead of inserting a new
"generic" worksheet).



DCSwearingen wrote:

Many Thanks to Dave Peterson!!

In my earlier, not so elegant way of doing this, I wanted to maintain
my report formatting.

I copied that formatting to the the worksheet with the macro button and
saved my workbook with this macro as "Add_CR_Workbook.xls" and added the
following to the end of Dave code:

Windows("Add_CR_Workbook.xls").Activate
Cells.Copy

Windows(NewWkBkName).Activate
For iCtr = 1 To Worksheets.Count
Sheets(iCtr).Select
Cells.PasteSpecial Paste:=xlFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Next iCtr

--
DCSwearingen

------------------------------------------------------------------------
DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506
View this thread: http://www.excelforum.com/showthread...hreadid=542592


--

Dave Peterson


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
Return SEARCHED Column Number of Numeric Label and Value Sam via OfficeKB.com Excel Worksheet Functions 23 January 30th 06 06:16 PM
To add a label name on several sheets noelalain Excel Worksheet Functions 1 January 8th 06 09:21 AM
Update Excel table in Word automatically from data in Excel yvonnedemulder Excel Discussion (Misc queries) 1 December 6th 05 06:51 PM
Excel file automatically opens - More Info Lost4Now Excel Discussion (Misc queries) 2 December 4th 05 11:01 PM
How do I automatically send daily email of updated Excel workbook. How to automate emails with excel file. Excel Discussion (Misc queries) 1 May 9th 05 08:55 PM


All times are GMT +1. The time now is 07:05 PM.

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"