ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create a new Sheet Q (https://www.excelbanter.com/excel-programming/419550-create-new-sheet-q.html)

Seanie

Create a new Sheet Q
 
The following is an extract of some code that creates a new sheet
after the activesheet. How could I tweak to insert this new sheet
after the sheet called "Start" - this sheet called Start is actual
just to the right of the active sheet, to the new sheet I wish to
create will now be to the right of the sheet called "Start" and thus 2
sheets to the right of the active sheet

Thanks


If SheetExists(newShtName) Then
MsgBox "You have already created this week.If you have made an
error, delete the week sheet tab and e-mail again", vbCritical
Exit Sub
End If
ActiveSheet.Copy after:=ActiveSheet
ActiveSheet.Name = newShtName
ActiveSheet.Tab.ColorIndex = -4142

Mike H

Create a new Sheet Q
 
Try this

ActiveSheet.Copy after:=Sheets("Start")

Mike

"Seanie" wrote:

The following is an extract of some code that creates a new sheet
after the activesheet. How could I tweak to insert this new sheet
after the sheet called "Start" - this sheet called Start is actual
just to the right of the active sheet, to the new sheet I wish to
create will now be to the right of the sheet called "Start" and thus 2
sheets to the right of the active sheet

Thanks


If SheetExists(newShtName) Then
MsgBox "You have already created this week.If you have made an
error, delete the week sheet tab and e-mail again", vbCritical
Exit Sub
End If
ActiveSheet.Copy after:=ActiveSheet
ActiveSheet.Name = newShtName
ActiveSheet.Tab.ColorIndex = -4142


The Code Cage Team[_89_]

Create a new Sheet Q
 

If SheetExists(newShtName) Then
MsgBox "You have already created this week.If you have made an
error, delete the week sheet tab and e-mail again", vbCritical
Exit Sub
End If
ActiveSheet.Copy after:=Sheets("Start")
ActiveSheet.Name = newShtName
ActiveSheet.Tab.ColorIndex = -4142


--
The Code Cage Team

Regards,
The Code Cage Team
www.thecodecage.com
------------------------------------------------------------------------
The Code Cage Team's Profile: http://www.thecodecage.com/forumz/member.php?userid=2
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=25369



All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com