Export (0) Print
Expand All
Expand Minimize

WorksheetBase.Cells Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets a Range object that represents all the cells on the worksheet (not just the cells that are currently in use).

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

public Range Cells { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.Range
A Range object that represents all the cells on the worksheet (not just the cells that are currently in use).

The following code example uses the Cells property to set the name, size, and boldness of the font in every cell on the worksheet.

This example is for a document-level customization.

private void SetCellFonts()
{
    this.Cells.Font.Name = "Verdana";
    this.Cells.Font.Size = 14;
    this.Cells.Font.Bold = true;
    this.Range["A1", "A5"].Value2 = 123;
}

Show:
© 2014 Microsoft