Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
'Try this but this will add a total of 31 tabs
Sub NameTheTabTodayAndNext31Days() Dim dayofmonth As Integer Dim movesheet As Integer On Error GoTo Errhandler dayofmonth = 1 movesheet = 4 Application.ScreenUpdating = False Application.DisplayAlerts = False Sheets.Add ActiveSheet.Name = Format(Now(), "[$-409]mmmm-dd-yyyy;@") '1 ActiveSheet.Move After:=Sheets(movesheet) movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '2 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '3 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '4 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '5 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '6 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '7 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '8 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '9 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '10 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '11 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '12 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '13 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '14 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '15 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '16 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '17 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '18 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '19 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '20 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '21 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '22 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '23 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '24 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '25 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '26 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '27 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '28 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '29 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '30 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets.Add ActiveSheet.Name = Format(Now() + dayofmonth, "[$-409]mmmm-dd-yyyy;@") '31 ActiveSheet.Move After:=Sheets(movesheet) dayofmonth = dayofmonth + 1 movesheet = movesheet + 1 Sheets(Array("Sheet3", "Sheet2", "Sheet1")).Select ActiveWindow.SelectedSheets.Delete Application.DisplayAlerts = True Application.ScreenUpdating = True Errhandler: If Err = 1004 Then MsgBox "Error # " & Err & " : " & Error(Err) ActiveSheet.Delete End If End Sub "David T" wrote: Is there a macro code that can automatically create the tabs based on the number of days of the month? "David T" wrote: Is there any way I can create a new tab for every day of the month and name that tab whatever the day of the month it is...ie Tab 1 will be named "1" (for day 1) and Tab 2 will be name "2" (for day 2) and so on and so forth. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Create Tabs | Excel Discussion (Misc queries) | |||
create view tabs | Excel Worksheet Functions | |||
Create tabs named after a group of cells? | Excel Discussion (Misc queries) | |||
How can Excel create a list of tabs on a worksheet? | Excel Discussion (Misc queries) | |||
How can I create multiple rows of worksheet tabs in a workbook? | Excel Discussion (Misc queries) |