title: How to create a VBA formula that takes value and format from source cell
body: <p>In Excel's VBA I want to create a formula which both takes the value from the source cell and the format. </p>
  
  <p>Currently I have:</p>
  
  <pre><code>Function formEq(cellRefd As Range) As Variant
      'thisBackCol = cellRefd.Interior.Color
      'With Application.Caller
      '    .Interior.Color = thisBackCol
      'End With
      formEq = cellRefd.Value
  End Function`
  </code></pre>
  
  <p>This returns the current value of the cell. The parts that I have commented out return a <code>#VALUE</code> error in the cell. When uncommented it seems the colour of the reference is saved however the <code>Application.Caller</code> returns a 2023 Error. Does this mean that this is not returning the required Range object?</p>
  
  <p>If so how do I get the range object that refers to the cell that the function is used? [obviously in order to set the colour to the source value].</p>