title: How to fill color in a cell in VBA?
body: <p>I would like to color cells that have "#N/A" value in the currentsheet. In order to do this i use following macro:</p>
  
  <pre><code>Sub ColorCells()
  
  Dim Data As Range
  Dim cell As Range
  Set currentsheet = ActiveWorkbook.Sheets("Comparison")
  Set Data = currentsheet.Range("A2:AW1048576")
  
  For Each cell In Data
  If cell.Value = "#N/A" Then
     cell.Interior.ColorIndex = 3
  End If
  Next
  
  End Sub
  </code></pre>
  
  <p>But the line <code>If cell.Value = "#N/A" Then</code> gives an error: Type mismatch. Maybe someone can help to understand where is the error? Thanks</p>