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
Use the Add method of the Sheets collection.
Dim newWorksheet As Excel.Worksheet newWorksheet = CType(Me.Application.Worksheets.Add(), Excel.Worksheet)
Excel.Worksheet newWorksheet; newWorksheet = (Excel.Worksheet)this.Application.Worksheets.Add();
The new worksheet is a native Microsoft.Office.Interop.Excel.Worksheet object and not a host item. You can also generate a Microsoft.Office.Tools.Excel.Worksheet host item from the native Microsoft.Office.Interop.Excel.Worksheet object. For more information, see Extending Word Documents and Excel Workbooks in Application-Level Add-ins at Run Time.
See Also
Tasks
How to: Programmatically Delete Worksheets from Workbooks
How to: Programmatically Select Worksheets
Concepts
Host Items and Host Controls Overview
Automating Excel by Using Extended Objects