Wednesday, 10 January 2018

How to add a new sheet to a Excel workbook using VBA code


We can insert a new worksheet to an Excel file using below code.

ThisWorkbook.Sheets.Add

Syntax : Workbook.Add ( Before, After, Count, Type) As Object

You can mention the position of the new worksheet by playing with Before and After.

If you wish to add multiple sheets, then you can mention the number in Count

Type is required if you want to add a chart sheet.