View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default EntireRow.Delete

Try this...

On Error Resume Next
Set rng = Range(Cells(5, "D"), Cells(Rows.Count, "D").End(xlUp))
Set rng = rng.SpecialCells(xlBlanks)

if not rng is nothing then rng.EntireRow.Delete
On Error GoTo 0

HTH


"Steph" wrote:

Hello. Anyone see a problem with the code below? It deletes an entire row
if cell D is blank. It works great if the range has a few blank cells in
it. BUT, if there are no blank cells in the range, it deletes the entire
range, and I have no idea why?! Help??

On Error Resume Next
Set rng = Range(Cells(5, "D"), Cells(Rows.Count, "D").End(xlUp))
Set rng = rng.SpecialCells(xlBlanks)
rng.EntireRow.Delete
On Error GoTo 0