VBA to reference newest sheet
Solved/Closed
pthfnd
-
4 Mar 2020 à 13:05
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 5 Mar 2020 à 11:56
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 5 Mar 2020 à 11:56
Related:
- VBA to reference newest sheet
- Create new sheet vba - Guide
- Vba find - Guide
- Little alchemy cheat sheet - Guide
- How to copy data from one excel sheet to another - Guide
- Vba case like - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 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