View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Delete rows if range is null and not in color...

How about this...

Sub test()
Dim rngUsed As Range
Dim rng As Range
Dim rngColour As Range
Dim rngToDelete As Range
Dim blnColour As Boolean

Set rngUsed = UsedRange.Columns(1).Cells
For Each rng In rngUsed
If Application.WorksheetFunction.CountA(rng.EntireRow ) = 0 Then
For Each rngColour In rng.EntireRow.Cells
If rngColour.Interior.ColorIndex < xlNone Then
blnColour = True
'Exit For
End If
Next rngColour
If blnColour = False Then
If rngToDelete Is Nothing Then
Set rngToDelete = rng
Else
Set rngToDelete = Union(rng, rngToDelete)
End If
End If
blnColour = False
End If
Next rng
If Not rngToDelete Is Nothing Then rngToDelete.EntireRow.Select
End Sub
--
HTH...

Jim Thomlinson


"jeremiah" wrote:

My spreadsheets has rows that are in color w/null values. There are others
that are just null and no color. I need to figure out how to delete only the
rows that have nulls, but not the ones that have color and also null. I have
searched and can't find quite the right response to my question. Thanks for
the help.

Jeremiah