Hi Guys,
I am trying to get the RGB values of a cell and I have found a function which does that here.
But what it does not do is update the RGB values when the cell fill is changed, like it would if the values in A1 and B1 were changed in the formula:
I have tried adding:
however this only seems to update the function on opening the function. I have also made sure that the calculation setting is set to automatic.
Is there a way to make the function recalculate when the user changes the fill colour?
Regards,
Shaun
I am trying to get the RGB values of a cell and I have found a function which does that here.
Code:
Function Color(rng As Range, Optional formatType As Integer = 0) As Variant
Application.Volatile
Dim colorVal As Variant
colorVal = Cells(rng.Row, rng.Column).Interior.Color
Select Case formatType
Case 1
Color = Hex(colorVal)
Case 2
Color = (colorVal Mod 256) & ", " & ((colorVal \ 256) Mod 256) & ", " & (colorVal \ 65536)
Case 3
Color = Cells(rng.Row, rng.Column).Interior.ColorIndex
Case Else
Color = colorVal
End Select
End Function
But what it does not do is update the RGB values when the cell fill is changed, like it would if the values in A1 and B1 were changed in the formula:
Code:
=A1+B1
Code:
Application.Volatile
Is there a way to make the function recalculate when the user changes the fill colour?
Regards,
Shaun