Hi,
I need a code, which would enable me to return the color index of a colored cell (colored via conditional formatting). If there is a colored reference cell, return the respective color index in next cell. I use Excel 2007. I need it only for four colors – red, blue, yellow and green. If the cell is not colored, return 0. I have tried some code, which is out on the net, without success, it does not work.
Thank you very much!
Perhaps something like this?
AlfOption Explicit Sub find_col() Dim i As Integer i = ActiveCell.Interior.ColorIndex End Sub
Hi Dpopov,
Welcome to the forum.
See the attached file where I have created a UDF (Vb function) to achieve the desired results.
Also, below are the color codes which you require, else formula will say either it is No color / different color.
Color Codes
------------
Red = 3
Blue = 23
Yellow = 6
Green= 14
Regards,
DILIPandey
<click on below 'star' if this helps>
DILIPandey
+919810929744
dilipandey@gmail.com
Hi DILIPandey,
Thank you a lot. I will try it out tomorrow. I am sure it will work.
Regards,
dpopov
Alf,
thank you for the code. I will see if it works.
Regards,
dpopov
Hi Bob,
You are correct.. there is difference between coloring manually and coloring by conditional format...
Dpopov, see the below link:-
http://www.cpearson.com/excel/CFColors.htm
Regards,
DILIPandey
<click on below 'star' if this helps>
DILIPandey
+919810929744
dilipandey@gmail.com
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks