Add Method (Worksheets Collection)

Applies To

Worksheets Collection.

Description

Creates a new worksheet. The new worksheet becomes the active sheet. Returns a Worksheet object.

Syntax

object.Add(before, after, count, type)

object

Required. The Worksheets object.

before

Optional. Specifies the sheet before which the new sheet is added.

after

Optional. Specifies the sheet after which the new sheet is added.

count

Optional. The number of sheets to add. One if omitted.

type

Optional. Specifies the worksheet type (one of xlWorksheet, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet). If omitted, the default is xlWorksheet.

Remarks

If before and after are omitted, the new sheet is inserted before the active sheet.

Example

This example creates a new worksheet and inserts it before the active sheet.


ActiveWorkbook.Worksheets.Add

This example adds a new worksheet after the last worksheet in the active workbook.


Worksheets.Add.Move after:=Worksheets(Worksheets.Count)