I'm not able to change any calling cell attributes via Application.Caller. This leads me to believe that Application Caller is read-only, and that we have to extract the Workbook & sheet name, then access the cell via Workbook("WorkbookName").Sheet("SheetName").etc.
. Is this correct? My test code is below.
<...start code...>
Function AsnWrongColr() As Variant
Debug.Print
Debug.Print "Function AsnWrongColr()"
Debug.Print "-----------------------"
Debug.Print "ActiveSheet.Name="""; ActiveSheet.Name; """"
#If 0 Then
'''Use this section if invoking from cell formula in A7
'Confirm that we are at the right sheet
Debug.Print "Application.Caller.Parent.Name="""; _
Application.Caller.Parent.Name; """"
AsnWrongColr = "Blah" 'Return value for caller to display
'Application.Caller.Offset(1, 1) = "Bleh" 'Test access to neighbour
'Comment out cuz execution doesn't go beyond this line
Application.Caller.Interior.Color = vbGreen
'Try set calling cell color
Debug.Print "Caller color "; Application.Caller.Interior.Color
'This will show that the cell color remains unchanged
#Else
'''Use this section if just running the macro
Range("A7").Interior.Color = vbGreen
#End If
Debug.Print "A7 color "; Range("A7").Interior.Color
Debug.Print "Note: vbGreen is "; vbGreen
Debug.Print
End Function
<...end code...>