title: Get Excel cell background color hex value
body: <p>I would like to obtain the background color of a cell in an Excel sheet using a UDF formula or VBA.
  I found this UDF:</p>
  
  <pre><code>Public Function BColor(r As Range) As Long 
      BColor = r(1).Interior.ColorIndex 
  End Function
  </code></pre>
  
  <p>It can be used like this in a cell: <code>=BColor(A1)</code>
  I'm not familiar with VBA, this returns some long value and I wonder if it is possible to obtain the hex value directly. Thank you!</p>