VBA to reference newest sheet
Solved/Closed
pthfnd
-
Mar 4, 2020 at 01:05 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 5, 2020 at 11:56 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 5, 2020 at 11:56 AM
Related:
- VBA to reference newest sheet
- Google sheet right to left - Guide
- Vba case like - Guide
- Windows network commands cheat sheet - Guide
- Number to words in excel formula without vba - Guide
- Little alchemy cheat sheet - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Updated on Jul 23, 2020 at 11:33 AM
Updated on Jul 23, 2020 at 11:33 AM
Hi Pthfnd,
A sheet with a specific structure used to create new sheets with, is called a template sheet.
A template sheet is usually the last sheet. The code below will ask you for a name to give the new sheet. It will then copy the template, give it's name and place it before the template sheet.
Here is the code:
Let us know how this works out for you.
Best regards,
Trowa
A sheet with a specific structure used to create new sheets with, is called a template sheet.
A template sheet is usually the last sheet. The code below will ask you for a name to give the new sheet. It will then copy the template, give it's name and place it before the template sheet.
Here is the code:
Sub RunMe() Dim sName As String sName = InputBox("Enter the name for the new sheet:", "New sheet name") Sheets("Template").Copy before:=Sheets("Template") ActiveSheet.Name = sName End Sub
Let us know how this works out for you.
Best regards,
Trowa