ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   add new worksheet after specific sheet (https://www.excelbanter.com/excel-programming/403282-add-new-worksheet-after-specific-sheet.html)

donbowyer

add new worksheet after specific sheet
 
Excel 2003 on WinXL
I have a workbook with several named sheets.
I wish to programatically add a new named sheet after a named existing sheet
(lets call it MySheet) without Activating or selecting MySheet.
AddSheets After... doesnt seem to allow this.
--
donwb

Bob Phillips

add new worksheet after specific sheet
 
Worksheets.Add(After:=Worksheets("MySheet")).Name = "NewSheet"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"donbowyer" wrote in message
...
Excel 2003 on WinXL
I have a workbook with several named sheets.
I wish to programatically add a new named sheet after a named existing
sheet
(lets call it MySheet) without Activating or selecting MySheet.
AddSheets After... doesnt seem to allow this.
--
donwb




donbowyer

add new worksheet after specific sheet
 
Thanks Bob - it was the syntax that evaded me
--
donwb


"Bob Phillips" wrote:

Worksheets.Add(After:=Worksheets("MySheet")).Name = "NewSheet"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"donbowyer" wrote in message
...
Excel 2003 on WinXL
I have a workbook with several named sheets.
I wish to programatically add a new named sheet after a named existing
sheet
(lets call it MySheet) without Activating or selecting MySheet.
AddSheets After... doesnt seem to allow this.
--
donwb






All times are GMT +1. The time now is 12:47 PM.

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