![]() |
How do I increment tabs by date in a workbook?
I have a workbook for each day of the month of June. The name in each tab
will be each day of the month. I don;t want to have to rename each tab. I should be able to let excel update the tabs. HOW? -- Roaddog |
How do I increment tabs by date in a workbook?
Sub NewWorksheet()
Dim i As Integer on error resume next For i = 2 To 31 ActiveWorkbook.Worksheets.Add ActiveSheet.Name = "Jun" & i Next i End Sub -- Don Guillett SalesAid Software "Harley" wrote in message ... I have a workbook for each day of the month of June. The name in each tab will be each day of the month. I don;t want to have to rename each tab. I should be able to let excel update the tabs. HOW? -- Roaddog |
How do I increment tabs by date in a workbook?
Work backwards to not have to sort
Sub mynewsheets() on error resume next For i = 31 To 1 Step -1 On Error Resume Next Sheets.Add.Name = "Jun" & i Next i End Sub -- Don Guillett SalesAid Software "Harley" wrote in message ... I have a workbook for each day of the month of June. The name in each tab will be each day of the month. I don;t want to have to rename each tab. I should be able to let excel update the tabs. HOW? -- Roaddog |
How do I increment tabs by date in a workbook?
Harley
Try this code from Chip Pearson. Sub NameSheets() 'Chip Pearson Feb 14th, 2007 Dim Ndx As Long Dim StartMonth As Variant StartMonth = Application.InputBox(Prompt:="Enter the month number.", Type:=1) If StartMonth = False Then Exit Sub End If For Ndx = 1 To ActiveWorkbook.Worksheets.Count ActiveWorkbook.Worksheets(Ndx).Name = Format(DateSerial( _ IIf(StartMonth = 1, Year(Now) + 1, Year(Now)), StartMonth, Ndx), _ "dd mmm yyyy") Next Ndx End Sub Gord Dibben MS Excel MVP On Wed, 27 Jun 2007 11:28:06 -0700, Harley wrote: I have a workbook for each day of the month of June. The name in each tab will be each day of the month. I don;t want to have to rename each tab. I should be able to let excel update the tabs. HOW? |
All times are GMT +1. The time now is 11:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com