Hi Guys
New member here stuck when using UDF for the first time. I am trying to write a function that reads the colours of an individual cell in a cell range and returns a value depending on what colour is highlighted. My Function looks like:
Function CheckColor2(range)
If range.Interior.ColorIndex = 3 Then
CheckColor2 = "Poor"
ElseIf range.Interior.ColorIndex = 44 Then
CheckColor2 = "Fair"
ElseIf range.Interior.ColorIndex = 6 Then
CheckColor2 = "Good"
ElseIf range.Interior.ColorIndex = 43 Then
CheckColor2 = "Excellent"
Else
CheckColor2 = "N/A"
End If
End Function
In the cells I enter:
=CheckColor2(C23:F23)
The issue I am having is that all the cells in my range need to be highlighted for the function to work. Is there a way to rewrite this so that if any cell within my range is a certain colour it will return the correct value?
Salt
New member here stuck when using UDF for the first time. I am trying to write a function that reads the colours of an individual cell in a cell range and returns a value depending on what colour is highlighted. My Function looks like:
Function CheckColor2(range)
If range.Interior.ColorIndex = 3 Then
CheckColor2 = "Poor"
ElseIf range.Interior.ColorIndex = 44 Then
CheckColor2 = "Fair"
ElseIf range.Interior.ColorIndex = 6 Then
CheckColor2 = "Good"
ElseIf range.Interior.ColorIndex = 43 Then
CheckColor2 = "Excellent"
Else
CheckColor2 = "N/A"
End If
End Function
In the cells I enter:
=CheckColor2(C23:F23)
The issue I am having is that all the cells in my range need to be highlighted for the function to work. Is there a way to rewrite this so that if any cell within my range is a certain colour it will return the correct value?
Salt