title: Replace cell value with image
body: <p>I have an Excel file with a table containing values O and G. I want to replace O with an orange icon and G with a green icon</p>
  <p>How do I read each cell for value O and G and replace them with their respective image?</p>
  <pre><code>Private Sub CommandButton1_Click()
  
  For Each c In Worksheets(&quot;Summary (2)&quot;).Range(&quot;A1:D10&quot;)
      If c.Value = 0 Then
          c.Value = Orange
      ElseIf c.Value = G Then
          c.Value = &quot;Green&quot;
      Else
          c.Value = &quot;&quot;
      End If
  Next c
  End Sub
  </code></pre>
  <p><a href="https://i.stack.imgur.com/YgFDM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YgFDM.png" alt="enter image description here" /></a></p>