COUNT "INTERIORCOLOR" CELLS

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
I have a 8 column sheet with in the first columns a text.The other 7 columns are filled with numbers.
Some of this cells have an "interiorcolor".
On a row some have three cells colored,other rows have 5 colored and so on.All different.
Perhaps there are rows with SEVEN colored cells.
What I want to do is to write a macro that jumps by the "enter" to every row who have SEVEN colored cells?
Is this possible?
Who can help me.
Many thanks
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try the following:

Dim RowColors(8)
Dim SevenColors(100)
Dim NumRow, r, c As Long
NumRow = Intersect(Columns(1), ActiveSheet.UsedRange).Rows.Count
For r = 1 To NumRow
For c = 2 To 8
RowColors(c - 2) = Cells(r, c).Interior.ColorIndex
Next c
If RowColors(0) <> RowColors(1) And RowColors(0) <> RowColors(2) And RowColors(0) <> RowColors(3) _
And RowColors(0) <> RowColors(4) And RowColors(0) <> RowColors(5) And RowColors(0) <> RowColors(6) _
And RowColors(1) <> RowColors(2) And RowColors(1) <> RowColors(3) And RowColors(1) <> RowColors(4) _
And RowColors(1) <> RowColors(5) And RowColors(1) <> RowColors(6) And RowColors(2) <> RowColors(3) _
And RowColors(2) <> RowColors(4) And RowColors(2) <> RowColors(5) And RowColors(2) <> RowColors(6) _
And RowColors(3) <> RowColors(4) And RowColors(3) <> RowColors(5) And RowColors(3) <> RowColors(6) _
And RowColors(4) <> RowColors(5) And RowColors(4) <> RowColors(6) And RowColors(5) <> RowColors(6) _
And RowColors(0) <> RowColors(7) And RowColors(1) <> RowColors(7) And RowColors(2) <> RowColors(7) _
And RowColors(3) <> RowColors(7) And RowColors(4) <> RowColors(7) And RowColors(5) <> RowColors(7) _
And RowColors(6) <> RowColors(7) Then
MsgBox "Row " & r & " has seven unique interior colors"
End If
Next r

I know its not pretty, but I couldn't think of another way to do it.
 
Upvote 0

Forum statistics

Threads
1,214,390
Messages
6,119,235
Members
448,879
Latest member
VanGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top