Row Property

Microsoft Office Web Components Object Model

Row Property

       

Returns the number of the first row in the specified range. Read-only Long.

expression.Row

expression   Required. An expression that returns one of the objects in the Applies To list.

Example

This example makes every other row green in the current region for cell A1.

Sub FormatRows()

   Dim rngCurrentRow

   ' Loop through all of the rows int he current region.
   For Each rngCurrentRow In Spreadsheet1.Cells(1, 1).CurrentRegion.Rows

      ' Check to see if the row number is an even number.
      If rngCurrentRow.Row Mod 2 = 0 Then

         ' Set the interior color of the row.
         rngCurrentRow.Interior.Color = "LightGreen"
      End If
   Next
End Sub