Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Do you need a dated tab name for every day of each month?
|
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Yes that is exactly what I need.
"Dave O" wrote: Do you need a dated tab name for every day of each month? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Return SEARCHED Column Number of Numeric Label and Value | Excel Worksheet Functions | |||
To add a label name on several sheets | Excel Worksheet Functions | |||
Update Excel table in Word automatically from data in Excel | Excel Discussion (Misc queries) | |||
Excel file automatically opens - More Info | Excel Discussion (Misc queries) | |||
How do I automatically send daily email of updated Excel workbook. | Excel Discussion (Misc queries) |