Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Renaming Tabs in a Macro
Hi! I have an existing macro that reformats several things on a workheet and
then copies the worksheet to another worksheet in the same book and sorts it in a different order. I then have to manually rename the two worksheets - the first one to "20081030 by Name" and the second tab to "20081030 by Loc", where 20081030 is the date. What would I add in the macro to change the two tabs automatically to the current date and "by Name" and the current date and "by Loc"? Thanks in advance for your help! Liz |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Renaming Tabs in a Macro
Worksheets("Old Name").Name = "New Name"
"Liz C" wrote: Hi! I have an existing macro that reformats several things on a workheet and then copies the worksheet to another worksheet in the same book and sorts it in a different order. I then have to manually rename the two worksheets - the first one to "20081030 by Name" and the second tab to "20081030 by Loc", where 20081030 is the date. What would I add in the macro to change the two tabs automatically to the current date and "by Name" and the current date and "by Loc"? Thanks in advance for your help! Liz |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Renaming Tabs in a Macro
That'll work, but how do I get it to put the current date in the correct
format as part of the name? "Sheeloo" wrote: Worksheets("Old Name").Name = "New Name" "Liz C" wrote: Hi! I have an existing macro that reformats several things on a workheet and then copies the worksheet to another worksheet in the same book and sorts it in a different order. I then have to manually rename the two worksheets - the first one to "20081030 by Name" and the second tab to "20081030 by Loc", where 20081030 is the date. What would I add in the macro to change the two tabs automatically to the current date and "by Name" and the current date and "by Loc"? Thanks in advance for your help! Liz |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Renaming Tabs in a Macro
Sample code to get the date in the desired format
Sub t() Dim effdate As Long effdate = Right(Date, 4) & Left(Date, 2) & Mid(Date, 4, 2) MsgBox effdate End Sub My default date format is mm/dd/yyyy You may have to re-arrange the components if your format is different MsgBox date will tell you what you have "Liz C" wrote: That'll work, but how do I get it to put the current date in the correct format as part of the name? "Sheeloo" wrote: Worksheets("Old Name").Name = "New Name" "Liz C" wrote: Hi! I have an existing macro that reformats several things on a workheet and then copies the worksheet to another worksheet in the same book and sorts it in a different order. I then have to manually rename the two worksheets - the first one to "20081030 by Name" and the second tab to "20081030 by Loc", where 20081030 is the date. What would I add in the macro to change the two tabs automatically to the current date and "by Name" and the current date and "by Loc"? Thanks in advance for your help! Liz |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Renaming Multiple Tabs | Excel Worksheet Functions | |||
Renaming Tabs | Excel Discussion (Misc queries) | |||
renaming worksheet tabs | Excel Discussion (Misc queries) | |||
Hyperlinks and renaming tabs | Excel Discussion (Misc queries) | |||
Renaming Tabs | Excel Discussion (Misc queries) |