use textbox content to copy and rename worksheet

stewie09

New Member
Joined
Sep 23, 2006
Messages
3
Can anyone please help me with this Excel task? I am trying to create a macro which I will allow me to enter a name in a textbox on a userform. Then when I click on the Create button, the macros makes a copy of a worksheet (the worksheet is currently named Cal2007.). After making the copy. The copied worksheet should be renamed using the name that was entered in the text box.

Thanks
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hello stewie09, welcome to the board.
Assuming your textbox is still named 'TextBox1' you can use something like this
for the code in your userform's Create button.
Code:
Sheets("Cal2007").Copy Before:=Sheets(1)
ActiveSheet.Name = TextBox1.Value
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,539
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top