View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Shane Devenshire[_2_] Shane Devenshire[_2_] is offline
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?