title: I want to compare all cells of sheet 1 to sheet 2 and matched values turn yellow
body: <p>I want to compare all cells of sheet 1 to sheet 2 and matched values turn yellow, following code i used,</p>
  
  <pre><code> Sub match()
      Dim varSheetA As Variant
      Dim varSheetB As Variant
      Dim strRangeToCheck As String
      Dim iRow As Long
      Dim iCol As Long
      strRangeToCheck = "A1:IV65536"
      varSheetA = Worksheets("Sheet1").Range(strRangeToCheck)
      varSheetB = Worksheets("Sheet2").Range(strRangeToCheck)
      Debug.Print Now
      For icell = LBound(varSheetA, 1) To UBound(varSheetA, 1)
  
      If varSheetA(icell) = varSheetB(icell) Then
      cell.Interior.Color = vbYellow
  
       `enter code here` End If
      Next icell
  
     End Sub
  </code></pre>