Skip to content

Latest commit

 

History

History
53 lines (33 loc) · 1.33 KB

Excel.Worksheet.Rows.md

File metadata and controls

53 lines (33 loc) · 1.33 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Worksheet.Rows property (Excel)
vbaxl10.chm175122
vbaxl10.chm175122
Excel.Worksheet.Rows
5d07304e-a3c9-2a75-b2ba-4a7b16ce6516
05/30/2019
medium

Worksheet.Rows property (Excel)

Returns a Range object that represents all the rows on the specified worksheet.

Syntax

expression.Rows

expression A variable that represents a Worksheet object.

Remarks

Using the Rows property without an object qualifier is equivalent to using ActiveSheet.Rows. If the active document isn't a worksheet, the Rows property fails.

To return a single row, use the Item property or equivalently include an index in parentheses. For example, both Rows(1) and Rows.Item(1) return the first row of the active sheet.

Example

This example deletes row three on Sheet1.

Worksheets("Sheet1").Rows(3).Delete

This example deletes all rows on worksheet one where the value of cell one in the row is the same as the value of cell one in the previous row.

For Each rw In Worksheets(1).Rows 
   this = rw.Cells(1, 1).Value 
   If this = last Then rw.Delete 
   last = this 
Next

[!includeSupport and feedback]