Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 88
Default Macro: Copy a worksheet and rename it to a specified value

I've got a userform created with a textbox, an apply button and a cancel
button. If OK is clicked, i want the macro to duplicate a specific named
worksheet (say template) and rename the duplicate to the value in the textbox.

This doesn't seem to be terrible difficult, but I'm having problems. Any
advice?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Macro: Copy a worksheet and rename it to a specified value

OldSheet = "Sheet1"
Worksheets(OldSheet).Copy after:=Sheets(Sheets.Count)
Set Newsht = ActiveSheet
Newsht.Name = "Joel"

"mitch" wrote:

I've got a userform created with a textbox, an apply button and a cancel
button. If OK is clicked, i want the macro to duplicate a specific named
worksheet (say template) and rename the duplicate to the value in the textbox.

This doesn't seem to be terrible difficult, but I'm having problems. Any
advice?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default Macro: Copy a worksheet and rename it to a specified value

Hi,

Private Sub OK_Click()
Sheets("Template").Copy After:=ActiveSheet
ActiveSheet.Name = Me.TextBox1
Unload Me
End Sub

where TextBox1 is the name of your textbox on the form. and the ok button is
named OK.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"mitch" wrote:

I've got a userform created with a textbox, an apply button and a cancel
button. If OK is clicked, i want the macro to duplicate a specific named
worksheet (say template) and rename the duplicate to the value in the textbox.

This doesn't seem to be terrible difficult, but I'm having problems. Any
advice?

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
Macro to copy a worksheet and rename based upon text entered in 1 edeaston Excel Discussion (Misc queries) 5 December 5th 08 05:47 PM
Copy worksheet and rename sheet Ernst - EXE Graphics Excel Discussion (Misc queries) 4 July 25th 08 01:18 PM
Copy, Paste and Rename a Range using a macro [email protected] Excel Discussion (Misc queries) 1 April 15th 08 03:58 PM
Macro REQ: Automatically copy a template sheet and rename MCSmarties Excel Worksheet Functions 5 October 11th 07 09:18 PM
Rename worksheet in macro JBW Excel Worksheet Functions 1 September 24th 07 05:58 PM


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