Share via


Worksheet.Cells Property (2007 System)

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.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Cells As Range
'Usage
Dim instance As Worksheet 
Dim value As Range 

value = instance.Cells
[BrowsableAttribute(false)]
public Range Cells { get; }
[BrowsableAttribute(false)]
public:
property Range^ Cells {
    Range^ get ();
}
public function get Cells () : Range

Property Value

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

Examples

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

.NET Framework Security

See Also

Reference

Worksheet Class

Worksheet Members

Microsoft.Office.Tools.Excel Namespace