Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

WorksheetBase.Cells Property

Definition

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

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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

public:
 property Microsoft::Office::Interop::Excel::Range ^ Cells { Microsoft::Office::Interop::Excel::Range ^ get(); };
public Microsoft.Office.Interop.Excel.Range Cells { get; }
member this.Cells : Microsoft.Office.Interop.Excel.Range
Public ReadOnly Property Cells As Range

Property Value

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

Remarks

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;
}
Private Sub SetCellFonts()
 With Me.Cells.Font
 .Name = "Verdana"
 .Size = 14
 .Bold = True
 End With
 Me.Range("A1", "A5").Value2 = 123
End Sub

Applies to