View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Shane Devenshire Shane Devenshire is offline
external usenet poster
 
Posts: 857
Default Delete row with empty cell in column

Hi,

Here is code to delete all rows which have blank cells in column A. You can
modify this to delete all cells of many different types and for any column.

Sub DeleteRows()
Range("A1:A" &
Range("A65536").End(xlUp).Row).SpecialCells(xlCell TypeBlanks).EntireRow.Delete
End Sub

The advantage of this type of code is it uses Excel's built in feature and
therefor runs very fast, in fact, between 60-100 times faster than loops.

In this case I am deleting the entire row but you can replace the
..EntireRow.Delete with .Delete Shift:=XLUp

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Gene Augustin" wrote:

I have a worksheet with a column named DATE. Some of the date cells are
empty. I want a macro to delete all of the rows in which the date cell is
empty.


Gene Augustin