Range.Rows (Excel)

Returns a Range object that represents the rows in the specified range.

To return a single row, use the Item property or equivalently include an index in parentheses. For example, both Selection.Rows(1) and Selection.Rows.Item(1) return the first row of the selection. When applied to a Range object that is a multiple selection, this property returns rows from only the first area of the range. For example, if the Range object someRange has two areas—A1:B2 and C3:D4—,someRange.Rows.Count returns 2, not 4. To use this property on a range that may contain a multiple selection, test Areas.Count to determine whether the range is a multiple selection. If it is, loop over each area in the range, as shown in the third example. The returned range might be outside the specified range. For example, Range("A1:B2").Rows(5) returns cells A5:B5. For more information, see the Item property. Using the Rows property without an object qualifier is equivalent to using ActiveSheet.Rows. For more information, see the Worksheet.Rows property.


Dim rngRows As Range
Set rngRows = ActiveCell.Rows