Compartilhar via


Worksheet.Cells Property

Excel Developer Reference

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

Syntax

expression.Cells

expression   A variable that represents a Worksheet object.

Remarks

Because the Item property is the default property for the Range object, you can specify the row and column index immediately after the Cells keyword. For more information, see the Item property and the examples for this topic.

Using this property without an object qualifier returns a Range object that represents all the cells on the active worksheet.

Example

This example sets the font size for cell C5 on Sheet1 to 14 points.

Visual Basic for Applications
  Worksheets("Sheet1").Cells(5, 3).Font.Size = 14

This example clears the formula in cell one on Sheet1.

Visual Basic for Applications
  Worksheets("Sheet1").Cells(1).ClearContents

This example sets the font and font size for every cell on Sheet1 to 8-point Arial

Visual Basic for Applications
  With Worksheets("Sheet1").Cells.Font
    .Name = "Arial"
    .Size = 8
End With

See Also