Delete row if A1 is empty

melidrie

New Member
Joined
Dec 2, 2016
Messages
8
Hi,

i have a code but there is one thing that isnt working..

It wont delete 1 row because in column M1 there is still data.

What i want is that, if there is no data in cell A1 delete entire row even if there is data in column M1

Any suggestions?

Code:
Last = Cells(Rows.Count, "C").End(xlUp).Row    For i = Last To 1 Step -1
        If (Cells(i, "C").Value) = "CUSIP" Then
    'Cells(i, "A").EntireRow.ClearContents ' USE THIS TO CLEAR CONTENTS BUT NOT DELETE ROW
            Cells(i, "A").EntireRow.Delete
            
        End If
    Next i
'   Application.ScreenUpdating = True
Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete Shift:=xlUp
'Application.ScreenUpdating = True
End With
End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
If you want to delete based on A1 being empty all you should need is this.
Code:
If Range("A1").Value = "" Then
    Rows(1).Delete
End If
If you want to delete rows where column A is empty you can try this.
Code:
If Cells(i, "A").Value = "" Then
    Rows(i).Delete
End If
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,366
Members
449,080
Latest member
Armadillos

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