View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Selecting Blank Cells then deleting those rows

Perhaps:

Sub Highlighter()

Dim lngLastRow As Long
Dim rng As Range, rDelete As Range

lngLastRow = Cells(Rows.Count, "D").End(xlUp).Row

For Each rng In Range("D1:D" & lngLastRow)
If IsEmpty(rng) Then
If rDelete Is Nothing Then
Set rDelete = rng
Else
Set rDelete = Union(rDelete, rng)
End If
End If
Next rng
If rDelete Is Nothing Then
Else
rDelete.EntireRow.Delete
End If
End Sub
--
Gary''s Student - gsnu200909


"Mikey" wrote:

Ryan responded with this code to highlight the cells. What code would delete
the rows?
------------------------
So you just want to "Select" the cell? Use this,

Sub Highlighter()

Dim lngLastRow As Long
Dim rng As Range

lngLastRow = Cells(Rows.Count, "D").End(xlUp).Row

For Each rng In Range("D1:D" & lngLastRow)
If IsEmpty(rng) Then
rng.Select
Exit For
End If
Next rng

End Sub
--
Cheers,
Ryan


--
Mickey