Delete rows by criteria

Deverti

Board Regular
Joined
Sep 5, 2020
Messages
63
Office Version
  1. 365
Platform
  1. Windows
Im using this simple code as a part to clean a software export.

The additional criteria i dont know how to implement would be:
delete row if cell in column A is the only cell in said row that holds any value

VBA Code:
Sub DelEmptyRows()
lRow = Range("A" & Rows.Count).End(xlUp).Row
    Set rngA = Range("A10:A" & lRow)

    With ActiveSheet
        rngA.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    End With

End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Untested, but see if this works on a copy of your worksheet.
VBA Code:
Sub DelEmptyRows()
Application.ScreenUpdating = False
lRow = Range("A" & Rows.Count).End(xlUp).Row
    Set rngA = Range("A10:A" & lRow)
    For i = 1 To rngA.Rows.Count
        If Application.CountA(rngA(i)) = Application.CountA(rngA(i).EntireRow) _
            Then rngA(i).Value = ""
    Next i
    On Error Resume Next
    rngA.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    On Error GoTo 0
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,893
Messages
6,122,121
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top