ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comparing Fill Color (https://www.excelbanter.com/excel-programming/343679-comparing-fill-color.html)

magoobee[_2_]

Comparing Fill Color
 

Is there a way for me to determine the current fill color of a cell?

For example if the cell is red filled, I do not want to change the
color. But if it is any other color, I would would overlay with a
color.

I'm using VBA to comparing 2 fields values and then color filling
another based on the result. The code works fine but I do not want RED
fill to be overlaid.


--
magoobee
------------------------------------------------------------------------
magoobee's Profile: http://www.excelforum.com/member.php...o&userid=21581
View this thread: http://www.excelforum.com/showthread...hreadid=478811


Gary''s Student

Comparing Fill Color
 
Enter this small UDF:

Function clr(R As Range) As Integer
With R.Interior
clr = .ColorIndex
End With
End Function

Use it like =clr(A1). It will return a number corresponding to the
interior color of A1
--
Gary''s Student


"magoobee" wrote:


Is there a way for me to determine the current fill color of a cell?

For example if the cell is red filled, I do not want to change the
color. But if it is any other color, I would would overlay with a
color.

I'm using VBA to comparing 2 fields values and then color filling
another based on the result. The code works fine but I do not want RED
fill to be overlaid.


--
magoobee
------------------------------------------------------------------------
magoobee's Profile: http://www.excelforum.com/member.php...o&userid=21581
View this thread: http://www.excelforum.com/showthread...hreadid=478811




All times are GMT +1. The time now is 09:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com