View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Selecting Blank Cells then deleting those rows

Try this

Sub Highlighter()
Dim lngLastRow As Long
Dim rng As Long
LastRow = Cells(Rows.Count, "D").End(xlUp).Row
For rng = LastRow To 1 Step -1
If IsEmpty(Cells(rng, 4)) Then
Cells(rng, 4).EntireRow.Delete
End If
Next rng
End Sub

Mike

"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