title: Faster way to color table cells in Word
body: <p>I use VBA to create tables in Word from csv files. Some cells should be colored, so for these values I use a character "&amp;" in original csv:</p>
  
  <pre><code>.......
  1,234   6,789   &amp;4,321e+05
  &amp;-5,55  1,999   0,00
  .......
  </code></pre>
  
  <p>Then I use a loop through table cells:</p>
  
  <pre><code>    Set tbl = ActiveDocument.Tables(ActiveDocument.Tables.Count)
      For Each ce In tbl.Range.Cells
          a = ce.Range.Text
          If InStr(a, "&amp;") Then
              a = Replace(a, "&amp;", "")
              ce.Range.Text = a
              ce.Shading.BackgroundPatternColor = wdColorGray20
          End If
      Next
  </code></pre>
  
  <p>Since there can be many tables, and tables can be pretty large, this is sometimes very slow. Is there a faster way to do it?</p>