WorkbookNewSheet Event [Excel 2003 VBA Language Reference]

Occurs when a new sheet is created in any open workbook.

Private Subobject**_WorkbookNewSheet(ByValWbAs Workbook**, ByValShAs Object)

object An object of type Application declared with events in a class module. For more information, see Using Events with the Application Object .

Wb The workbook.

Sh The new sheet.

Example

This example moves the new sheet to the end of the workbook.

Private Sub App_WorkbookNewSheet(ByVal Wb As Workbook, _
        ByVal Sh As Object)
    Sh.Move After:=Wb.Sheets(Wb.Sheets.Count)
End Sub

Applies to | Application Object

See Also | NewSheet Event