Flora Edwards
asked on
how can i return the name of color from the cell background?
how can i return the name of color from the cell background? for example if cell color is green, i put a function like cell colorname(a1) and it should return green.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well just saw professor's reply in 11 seconds earlier than me, and that is what I meant by coding an array for the basic colors !!! try putting variance and this wont work.
try shading of blue or anything ...
gowflow
try shading of blue or anything ...
gowflow
Here is short version:
Function GetColor(r As Range) As Integer
GetColor = r.Interior.ColorIndex
End Function
Suppose your color is in A1, use below formula in B1:=GetColor(A1)
ASKER
thanks both.
the code worked. i had only 7 colors and it worked for me.
the code worked. i had only 7 colors and it worked for me.
ASKER
thanks so very much gowflow. you are right, if i had many colors, then it would not have worked. right now my workbook has 7 colors which the UDF worked, but it has another problem of returning error which i opened another question.
thanks Shams.
thanks Shams.
please post the link to the question and I will be glad to help.
gowflow
gowflow
ASKER
thanks gowflow. here is the link for the question https://www.experts-exchange.com/questions/29022854/just-curious-to-lean-why-these-two-UDFs-behaviors-are-different.html
May I ask why you need this as the question is quite opened. Maybe we can help you if you give more info as to the use of it.
gowflow