title: Excel: Change background color of a cell to RGB color written in that cell
body: <p>I have this code which shows rgb color of target cell:</p>
  
  <pre><code>Function getRGB(RefCell)
  Dim mystr As String
  Application.Volatile
      mystr = Right("000000" &amp; Hex(RefCell.Interior.Color), 6)
      getRGB = Application.Hex2Dec(Right(mystr, 2)) &amp; ", " &amp; _
               Application.Hex2Dec(Mid(mystr, 3, 2)) &amp; ", " &amp; _
               Application.Hex2Dec(Left(mystr, 2))
  End Function
  </code></pre>
  
  <p>I need that this code instead of showing off rgb of other cell, would change background color of its own cell. Maybe anyone know how to do it?</p>