Search notes:

Excel VBA: Worksheets.Add

worksheets.add adds a new worksheet to a workbook.
By default, the new worksheet is added to the «left» side of the worksheets. The optional parameters after or before can be used to specify the location where a worksheet needs to be inserted.

Parameters

before, after The object before/after the new sheet is inserted
count The number of sheets to be added
type A member of the xlSheetType enumeration
All paramters are optional

Simple example

option explicit

sub main() ' {

    dim wb as workbook
    set wb = workbooks.add(xlWBATWorksheet)

    dim shTwo   as workSheet
    dim shOne   as workSheet
    dim shThree as workSheet

    set shTwo    =  wb.workSheets(1)
    shTwo.name   = "Two"

    set shOne    =  wb.workSheets.add ' Add to the left, by default
    shOne.name   = "One"

    set shThree  =  wb.workSheets.add(after := shTwo)
    shThree.name = "Three"

end sub ' }
Github repository about-MS-Office-object-model, path: /Excel/Worksheets/add.bas

Index