W
Wayne Erfling
When I try to change the color of cell from a function called from that cell, the change never takes place.
function SetMyColor (colorindex)
Application.Caller.Interior.ColorIndex = colorindex 'this line never works
If Application.Caller.Interior.ColorIndex = xlNone Then
SetMyColor = "None"
Else
SetMyColor = Application.Caller.Interior.ColorIndex
End If
end function
I've tried any number of variations, including hardcoding the range, for example:
Range("J4").interior.ColorIndex = 17
and the color is never changed. I can change the color from a stand-along macro, just not from a function.
If I change the color manually, the function will return the colorIndex successfully.
Is this symptom part of a general issue of changing cells from within functions they call?
Is there a way around it?
Thanks!
---Wayne Erfling
function SetMyColor (colorindex)
Application.Caller.Interior.ColorIndex = colorindex 'this line never works
If Application.Caller.Interior.ColorIndex = xlNone Then
SetMyColor = "None"
Else
SetMyColor = Application.Caller.Interior.ColorIndex
End If
end function
I've tried any number of variations, including hardcoding the range, for example:
Range("J4").interior.ColorIndex = 17
and the color is never changed. I can change the color from a stand-along macro, just not from a function.
If I change the color manually, the function will return the colorIndex successfully.
Is this symptom part of a general issue of changing cells from within functions they call?
Is there a way around it?
Thanks!
---Wayne Erfling