title: User defined worksheet function returns #VALUE! error instead of cell color index
body: <p>Can someone please help me understand the problem with this function:</p>
  
  <pre><code>'the function returns the DISPLAYED color of specified cell
  Public Function cellDisplayCol(ByRef c As Range) As Long
     cellDisplayCol = c.DisplayFormat.Interior.ColorIndex
  End Function
  
  Sub test()
     MsgBox cellDisplayCol(ActiveCell)
  End Sub
  </code></pre>
  
  <p>the test works as expected but when I use the function in worksheet cell:
  =cellDisplayCol(A1)</p>
  
  <p>it returns #VALUE! error...</p>
  
  <p>Any ideas why? What should I fix?</p>
  
  <p>Many thanks!</p>