Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Macro to create a new worksheet that is a copy of an existing one?

I have created a button that I want to assign a macro to that will take the
information in a cell and make it the name of a new worksheet. This
worksheet needs to be a copy of an existing worksheet (#2 in position in the
line of worksheets currently) but with the name the user enters in the box
provided. Any suggestions?
-Kai
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Macro to create a new worksheet that is a copy of an existing one?

On Jul 2, 4:40 pm, Kai Cunningham
wrote:
I have created a button that I want to assign a macro to that will take the
information in a cell and make it the name of a new worksheet. This
worksheet needs to be a copy of an existing worksheet (#2 in position in the
line of worksheets currently) but with the name the user enters in the box
provided. Any suggestions?
-Kai


Hello Kal,

This macro use the value in cell A1 to rename the second worksheet (#2
in position).

Sub RenameSheet()
Worksheets(2).Name = ActiveSheet.Range("A1").Name
End Sub

Sincerely,
Leith Ross

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Macro to create a new worksheet that is a copy of an existing one?

On Jul 2, 4:40 pm, Kai Cunningham
wrote:
I have created a button that I want to assign a macro to that will take the
information in a cell and make it the name of a new worksheet. This
worksheet needs to be a copy of an existing worksheet (#2 in position in the
line of worksheets currently) but with the name the user enters in the box
provided. Any suggestions?
-Kai


Hello Kal,

This macro use the value in cell A1 to rename the second worksheet (#2
in position).

Sub RenameSheet()
Worksheets(2).Name = ActiveSheet.Range("A1").Text
End Sub

Sincerely,
Leith Ross

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Macro to create a new worksheet that is a copy of an existing one?

Hi,

Try this sub:

Sub AddNewSheet()
Dim SheetName As String
SheetName = Range("A1").Value
Sheets(2).Copy after:=Sheets(Sheets.Count)
On Error GoTo ErrHandler:
ActiveSheet.Name = SheetName
Exit Sub
ErrHandler:
MsgBox SheetName & " is not a valid sheet name or is already used."
End Sub

Regards,

Manu/


"Kai Cunningham" a écrit dans le
message de news: ...
I have created a button that I want to assign a macro to that will take the
information in a cell and make it the name of a new worksheet. This
worksheet needs to be a copy of an existing worksheet (#2 in position in
the
line of worksheets currently) but with the name the user enters in the box
provided. Any suggestions?
-Kai



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
Create Worksheet From Values in Existing Cells Using Existing Worksheet as Template. Ardy Excel Programming 18 November 29th 06 03:23 AM
create a macro to copy a worksheet into another Sean Excel Discussion (Misc queries) 7 October 18th 06 10:19 PM
Create a Macro to Copy a Worksheet, and link certain cells... jlstraw Excel Programming 0 February 24th 06 12:35 AM
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Excel Programming 1 October 17th 05 08:56 AM
How to create a macro to copy data from a column to a row in another worksheet? NewAtExcel Excel Programming 0 January 1st 04 12:38 AM


All times are GMT +1. The time now is 10:40 AM.

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

About Us

"It's about Microsoft Excel"