Sub deleteColoredRows()
Dim lngRow As Long
Dim lngN As Long
Const LtGray As Long = 15
Const DkGray As Long = 16
lngRow = Cells(Rows.Count, 1).End(xlUp).Row
For lngN = lngRow To 2 Step -1
If Cells(lngN, 1).Interior.ColorIndex = LtGray Or _
Cells(lngN, 1).Interior.ColorIndex = DkGray Then
Cells(lngN, 1).EntireRow.Delete
End If
Next
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
"Janis"
wrote in message
Sub deleteColoredRows()
Const LtGray = 15
Const DkGray = 16
Range("A1").EntireRow.Select
Do While ActiveCell.Value < ""
ActiveCell.Offset(1, 0).EntireRow.Select
Selection.Interior.ColorIndex = LtGray Or DkGray
EntireRow.Delete
Loop
End Sub
The loop works, the only thing wrong is the delete line.
If the row is either shade of gray I want it to delete.
what is the correct syntax for the delete line?
many thanks,