Row Property

Microsoft Office Web Components Visual Basic

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