Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Discover Cell Background Color

  Asked By: Dai    Date: Feb 21    Category: MS Office    Views: 812
  

I want to discover the backgound color of a cell and then take some
action depending upon the color.

So, how do I determine a cell's background color?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Gustavo Costa     Answered On: Feb 21

This is an extract of some code you can also find on the ExcelVBA site.
To determine  the color  index just use your recorder and add some colors you
would like to use.


With Range("A1")

nr = Range(.Cells(1, 1), .End(xlDown)).Rows.Count
nc = Range(.Cells(1, 1), .End(xlToRight)).Columns.Count

For r = 1 To nr
For c = 1 To nc

If .Cells(r, c).Interior.ColorIndex = ?? Then

ElseIf .Cells(r, c).Interior.ColorIndex = ?? Then

End If

Next c
Next r

End With

 
Didn't find what you were looking for? Find more on Discover Cell Background Color Or get search suggestion and latest updates.




Tagged: