Delete rows that contain colours?

M

Mally

What is the easiest way to delete rows that contain colours?

If there is a way does the complete row have to be coloured or can one cell
be coloured. It doesn't matter which way is used.

Thankyou
 
M

Mike H

Hi,

You could use a macro. This looks at column A and if any cell is red the
entire row is deleted. Right click the sheet tab, view code and paste it in.

Sub stantial()
Dim myrange, copyrange As Range
Set myrange = Range("A1:A1000")
For Each C In myrange
If C.Interior.ColorIndex = 3 Then
If copyrange Is Nothing Then
Set copyrange = C.EntireRow
Else
Set copyrange = Union(copyrange, C.EntireRow)
End If
End If
Next

If Not copyrange Is Nothing Then
copyrange.Delete
End If
End Sub


Mike
 
M

Mally

Hi Mike

Thankyou, thats great!

But sorry to be a pest, whats the colour for bright yellow as thats the
colour I have already used?
 
M

Mike H

Hi,

6

If you aren't sure of any others you may want, record a macro of you
colouring a cell and you will see the number in the recorded macro.

Mike
 
M

Mally

Thanks again

Mally

Mike H said:
Hi,

6

If you aren't sure of any others you may want, record a macro of you
colouring a cell and you will see the number in the recorded macro.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top