Delete rows if particular cell empty

C

Code Numpty

I need to include an instruction in a macro to delete rows, based on one cell
being empty.

If cell c10 (range name = "deliver_line1") is empty, then I want to delete
rows 10 to 15 (range name = "deliver_rows).

I have used
Range("Item_Nos").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
elsewhere, but this must relate to a cell which is not the first in the row.

Grateful for any help, thanks.
 
D

DomThePom

If IsEmpty(Range("deliver_line1")) Then
Sheets(1).Rows("10:15").EntireRow.Delete
End If
 
C

Code Numpty

Thanks Dom, I had to tweak it a bit to.....

If IsEmpty(Range("deliver_line1")) _
Then Sheets(1).Range("deliver_rows").EntireRow.Delete

When I first tried your code, it produced a compile error. No End If is
required as there is only one action as a result of the If, (apparently).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top