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 parameters 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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Microsof...', 1758199678, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Microsoft/Office/Excel/Object-Model/Worksheets/add(77): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78