Reverse the order of the new worksheet

amircse0711

New Member
Joined
Jul 22, 2019
Messages
25
Hello Everyone ,

I have created a macro to copy the active worksheet and paste a new one.

I want to make a slight modification to it : The newly created worksheet to be pasted on the left side of the workbook rather than on the right (My team is used to this format).

Dim sName As String
Dim i As Integer
i = ActiveWorkbook.Worksheets.Count
sName = Application.InputBox("Enter a name for the new sheet", "Add sheet")
If sName = "" Then Exit Sub
Worksheets(1).Copy after:=Worksheets(i)
ActiveSheet.Name = sName




Please tell me this is possible. Effort is much appreciated
 
Last edited:

Jon von der Heyden

MrExcel MVP, Moderator
Joined
Apr 6, 2004
Messages
10,685
Office Version
365
Platform
Windows
To have it as the first sheet, use Before, instead of After, and reference Worksheets(1​)
 

Forum statistics

Threads
1,077,822
Messages
5,336,564
Members
399,088
Latest member
Swindlestikz

Some videos you may like

This Week's Hot Topics

Top