Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Copying and Renaming New Sheet

Need help in VBA coding to make a copy of a sheet within the same file,
preferably just to the right of the original version, then rename that sheet
to include the day of month. For example, I want to take a sheet named Ship
Plan, make a copy of that sheet, then rename the new sheet Ship Plan (DD),
where DD is the current day of the month.

I know it's not tough, but just haven't done this before, so I'm hoping
someone can help with the code.

Thanks,
Todd

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Copying and Renaming New Sheet

hi
try this...
Sub newsheet()
Dim d As String
d = Format(Now(), "ddd")

ActiveSheet.Cells.Copy
Sheets.Add after:=ActiveSheet
ActiveSheet.Paste
ActiveSheet.Name = "Ship Plan " & d
End Sub

regards
FSt1

"T. Jenkins" wrote:

Need help in VBA coding to make a copy of a sheet within the same file,
preferably just to the right of the original version, then rename that sheet
to include the day of month. For example, I want to take a sheet named Ship
Plan, make a copy of that sheet, then rename the new sheet Ship Plan (DD),
where DD is the current day of the month.

I know it's not tough, but just haven't done this before, so I'm hoping
someone can help with the code.

Thanks,
Todd

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Copying and Renaming New Sheet

Sub newSht()
newDt = Format(Date, "ddd")
Worksheets("Ship Plan").Copy After:=Worksheets("Ship Plan")
ActiveSheet.Name = "Ship Plan_" & newDt
ThisWorkbook.Save
End Sub

"T. Jenkins" wrote:

Need help in VBA coding to make a copy of a sheet within the same file,
preferably just to the right of the original version, then rename that sheet
to include the day of month. For example, I want to take a sheet named Ship
Plan, make a copy of that sheet, then rename the new sheet Ship Plan (DD),
where DD is the current day of the month.

I know it's not tough, but just haven't done this before, so I'm hoping
someone can help with the code.

Thanks,
Todd

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Copying and Renaming New Sheet

I gave you day of the week.
To get day of the month change from:

newDt = Format(Date, "ddd")

TO:

newDt = Format(Date, "dd")


"T. Jenkins" wrote:

Need help in VBA coding to make a copy of a sheet within the same file,
preferably just to the right of the original version, then rename that sheet
to include the day of month. For example, I want to take a sheet named Ship
Plan, make a copy of that sheet, then rename the new sheet Ship Plan (DD),
where DD is the current day of the month.

I know it's not tough, but just haven't done this before, so I'm hoping
someone can help with the code.

Thanks,
Todd

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Copying and Renaming New Sheet

Thanks to both of you for the response. The code by JLG was more of what I
was looking for (i.e., copying the sheet rather than cells). Worked
perfectly.

Thanks for the help.

Todd

"JLGWhiz" wrote:

I gave you day of the week.
To get day of the month change from:

newDt = Format(Date, "ddd")

TO:

newDt = Format(Date, "dd")


"T. Jenkins" wrote:

Need help in VBA coding to make a copy of a sheet within the same file,
preferably just to the right of the original version, then rename that sheet
to include the day of month. For example, I want to take a sheet named Ship
Plan, make a copy of that sheet, then rename the new sheet Ship Plan (DD),
where DD is the current day of the month.

I know it's not tough, but just haven't done this before, so I'm hoping
someone can help with the code.

Thanks,
Todd

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 sheets with the same name after copying into a new workbo cdb Excel Discussion (Misc queries) 0 March 14th 06 04:25 PM
Copying and renaming a file Craig Excel Discussion (Misc queries) 1 February 24th 05 10:47 PM
copying and renaming a worksheet Matthew Donnelly Excel Programming 2 September 22nd 04 09:53 AM
copying and renaming sheets Jan Eikeland Excel Programming 9 December 23rd 03 07:55 PM
Copying and renaming worksheets John Young Excel Programming 1 December 17th 03 01:46 AM


All times are GMT +1. The time now is 05:03 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"