title: Excel VBA If cell.Value =... then
body: <p>I have this code which works well:</p>
  
  <pre><code>Sub colortest()
  Dim cell As Range
  For Each cell In Range("Range1")
  If cell.Value = "Word1" Then
  cell.Interior.Color = XlRgbColor.rgbLightGreen
  ElseIf cell.Value = "Word2" Then
  cell.Interior.Color = XlRgbColor.rgbOrange
  ElseIf cell.Value = "Word3" Then
  cell.Interior.Color = XlRgbColor.rgbRed
  End If
  Next cell
  End Sub
  </code></pre>
  
  <p>My problem is the values work only if the cell contains only that text. But my cells are usually like this: "Something, 10254, 15/15, <strong>Word1</strong> Another Word"
  I only need the <strong>Word1</strong>.
  Thank you,</p>