Create and Activate New Worksheet

Robby19

Board Regular
Joined
Mar 19, 2018
Messages
227
Hello,

I have a userform that creates and names a new worksheet when I click the Save button. Once the save button is entered I need another userform to activate (UserForm2) AND make the newly created worksheet activate so that the info on UserForm2 is transcribed to the new worksheet.

Userform Save button
Code:
'Creates a new worksheet
    Sheets.Add After:=Sheets(Sheets.Count)
    'Renames the new worksheet
    Sheets(Sheets.Count).Name = Drop.Value & " " & StartDate.Value & " " & StartTime.Value

Unload UserForm1

Drop.Value is text, example "abc", "def", etc...
StartDate.Value & StartTime.Value is a user inputted date/time
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
So actually, I think what would be better is if the Save button was able to copy another sheet in same workbook, rename it as per above, and then make that copied sheet activate. Is this possible?
 
Upvote 0
You would use something like this:
The new sheet would be the active sheet.

Modify names the way you want.
Code:
Sub Copy_Sheet()
'Modified  10/1/2018  3:26:55 AM  EDT
Sheets("David").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Jones"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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