Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ActiveSheet Property
Collapse the table of content
Expand the table of content

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: " + 
        worksheet1.Name);
}

Show:
© 2015 Microsoft