excel vba delete row code example
Example 1: excel vba delete rows in range
ThisWorkbook.Worksheets(1).Rows(3).EntireRow.Delete
ThisWorkbook.Worksheets("Feuil1").Rows(3).Cells.ClearContents
Range("My_RANGE").Rows(3).EntireRow.Delete
Example 2: excel vba delete empty rows
dim rRange As Range, rowsCount As Long, i As Long
Set rRange = ActiveSheet.Range("A1:B100")
rowsCount = rRange.rows.Count
For i = rowsCount To 1 Step -1
If WorksheetFunction.CountA(rRanges.rows(i)) = 0 Then
rRange.rows(i).Delete
End If
Next
Example 3: delete rows in excel vba code
Sub DeleteRowswithSpecificValue()
For i = Selection.Rows.Count To 1 Step -1
If Cells(i, 2).Value = "Printer" Then
Cells(i, 2).EntireRow.Delete
End If
Next i
End Sub
Example 4: excel vba delete rows
ThisWorkbook.Worksheets(1).Rows(3).EntireRow.Delete
ThisWorkbook.Worksheets("Feuil1").Rows(3).Cells.ClearContents
Range("My_RANGE").Rows(3).EntireRow.Delete