ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change Order of Inserted Worksheets (https://www.excelbanter.com/excel-programming/349727-change-order-inserted-worksheets.html)

Lilbit

Change Order of Inserted Worksheets
 
Everytime I add a worksheet, it appears in front of the current worksheet.
How do I get them to appear after the current worksheet? Thanks!!


Norman Jones

Change Order of Inserted Worksheets
 
Hi Lilbit,

Everytime I add a worksheet, it appears in front of the current
worksheet.
How do I get them to appear after the current worksheet? Thanks!!


Try:

Worksheets.Add , After:=Sheets(ActiveSheet.Index)


---
Regards,
Norman



Lilbit

Change Order of Inserted Worksheets
 
I've tried adding it in several locations, but I keep getting an error
message. Where would I put it in the following code (P.S. -- There is
already a Sheet1 worksheet. Right now, the result of the macro is Stage3,
Stage4, Stage5, Sheet1. I want Sheet1, Stage3, Stage4, Stage5):
Sheets.Add
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Stage5"
Sheets.Add
Sheets("Sheet3").Select
Sheets("Sheet3").Name = "Stage4"
Sheets.Add
Sheets("Sheet4").Select
Sheets("Sheet4").Name = "Stage3"

Thanks!!


Norman Jones

Change Order of Inserted Worksheets
 
Hi Lilbit,

Try:

'=============
Public Sub Tester001()
Dim i As Long

For i = 5 To 3 Step -1
Worksheets.Add , after:=Sheets("Sheet1")
ActiveSheet.Name = "Stage" & i
Next i

End Sub
'<<=============


---
Regards,
Norman



"Lilbit" wrote in message
lkaboutsoftware.com...
I've tried adding it in several locations, but I keep getting an error
message. Where would I put it in the following code (P.S. -- There is
already a Sheet1 worksheet. Right now, the result of the macro is Stage3,
Stage4, Stage5, Sheet1. I want Sheet1, Stage3, Stage4, Stage5):
Sheets.Add
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Stage5"
Sheets.Add
Sheets("Sheet3").Select
Sheets("Sheet3").Name = "Stage4"
Sheets.Add
Sheets("Sheet4").Select
Sheets("Sheet4").Name = "Stage3"

Thanks!!





All times are GMT +1. The time now is 10:41 AM.

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