Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default 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
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
Renaming Multiple Tabs britt@wjg Excel Worksheet Functions 1 October 8th 08 12:19 AM
Renaming Tabs Lakebum Excel Discussion (Misc queries) 3 December 26th 06 09:43 PM
renaming worksheet tabs calibronco Excel Discussion (Misc queries) 7 November 26th 05 01:02 AM
Hyperlinks and renaming tabs woolyhedgehog Excel Discussion (Misc queries) 0 October 18th 05 06:04 PM
Renaming Tabs ANDY73 Excel Discussion (Misc queries) 5 July 28th 05 09:42 AM


All times are GMT +1. The time now is 01:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"