Add Method (Sheets Collection)

Applies To

Sheets Collection.

Description

Creates a new worksheet, chart, module, dialog sheet or macro sheet.

Syntax

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

object

Required. The Sheets object.

before

Optional. Specifies the sheet before which the new sheet is added. Must be an object, for example ActiveWorkbook.Worksheets("Sheet1").

after

Optional. Specifies the sheet after which the new sheet is added. Must be an object, for example ActiveWorkbook.ActiveSheet.

count

Optional. The number of sheets to add. If omitted, the default is one.

type

Optional. The type of sheet to add. Must be one of xlWorksheet, xlChart, xlModule, xlDialogSheet, 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 inserts a new worksheet before the active sheet.


ActiveWorkbook.Sheets.Add before:=ActiveWorkbook.ActiveSheet

This example adds two new dialog sheets after Module1.


ActiveWorkbook.Sheets.Add after:=ActiveWorkbook.Sheets("Module1"), _
    type:=xlDialogSheet, count:=2