Share via


How to: Programmatically Add New Worksheets to Workbooks

You can programmatically create a worksheet and then add the worksheet to the collection of worksheets in the workbook.

Applies to: The information in this topic applies to document-level projects and application-level projects for Excel 2013 and Excel 2010. For more information, see Features Available by Office Application and Project Type.

To add a new worksheet to a workbook in a document-level customization

  • Use the Add method of the Sheets collection.

    Dim newWorksheet As Excel.Worksheet
    newWorksheet = CType(Globals.ThisWorkbook.Worksheets.Add(), Excel.Worksheet)
    
    Excel.Worksheet newWorksheet;
    newWorksheet = (Excel.Worksheet)Globals.ThisWorkbook.Worksheets.Add();
    

    The new worksheet is a native Microsoft.Office.Interop.Excel.Worksheet object and not a host item. If you want to add a Microsoft.Office.Tools.Excel.Worksheet host item, you should add the worksheet at design time.

To add a new worksheet to a workbook in an application-level add-in

See Also

Tasks

How to: Programmatically Delete Worksheets from Workbooks

How to: Programmatically Select Worksheets

Concepts

Working with Worksheets

Host Items and Host Controls Overview

Automating Excel by Using Extended Objects

Global Access to Objects in Office Projects

Optional Parameters in Office Solutions