title: VBA to highlight duplicate rows in two Worksheets
body: <p>I know very little about VBA code, but I can follow along the lines of logic in a given example. So I googled and found a code I edited to highlight duplicates in a worksheet. However, I have a workbook with three sheets. I would like to adapt this to compare sheet 1 and sheet 3, then highlight the duplicates in sheet 1. </p>
  
  <pre><code>Sub Highlight_Dups()
  
  Dim startRow As Integer
  startRow = 2
  
  Dim row As Integer
  row = startRow
  
  Do While (Range("A" &amp; row).Value &lt;&gt; "")
  
  Dim innerRow As Integer
  innerRow = row + 1
  
  Dim StudentID As String
  Dim DT As String
  Dim Description As String
  
  StudentID = Range("A" &amp; row).Value
  DT = Range("H" &amp; row).Value
  Description = Range("J" &amp; row).Value
  
  Do While (Range("A" &amp; innerRow).Value &lt;&gt; "")
  
  
      If (Range("A" &amp; innerRow).Value = StudentID And Range("H" &amp; innerRow).Value = DT And Range("J" &amp; innerRow).Value = Description) Then
          Range("X" &amp; row).Value = Range("X" &amp; row).Value &amp; innerRow &amp; ", "
          Range("X" &amp; innerRow).Value = Range("X" &amp; innerRow).Value &amp; row &amp; ", "
          Rows(row).Interior.ColorIndex = 6
  
          Rows(innerRow).Interior.ColorIndex = 6
      End If
  
  innerRow = innerRow + 1
  Loop
  
  row = row + 1
  Loop
  
  MsgBox "done", vbOKOnly, "done"
  
  End Sub
  </code></pre>
  
  <p>Any help on how to add ???= Sheets("Sheet1") and ??? = Sheets("Sheet3")
  would help me a great deal. Thanks</p>