Export (0) Print
Expand All
Expand Minimize

Workbook.ActiveSheet Property

Gets the active sheet (the sheet on top).

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public virtual Object ActiveSheet { get; }

Property Value

The active sheet (the sheet on top); a null reference (Nothing in Visual Basic) if no sheet is active.

If the workbook appears in more than one window, this property may be different in different windows.

The following code example uses the ActiveSheet property to display the name of the active worksheet.

private void DisplayActiveSheetName()
    Excel.Worksheet worksheet1 = (Excel.Worksheet)this.ActiveSheet;
    MessageBox.Show("The name of the active sheet is: " + 

© 2014 Microsoft