title: VBA to Compare if range exists in destination else add missing range 12 times
body: <p>I am currently able to check if column A values on Sheet-1 exists in Column A of Sheet-2 and add the missing 12 times. But, however I would like to check if Column A &amp; B combination on Sheet-1 exists in Column A &amp; B on Sheet-2 and add the missing 12 times. The following is a little illustration of how I require. </p>
  
  <p>As you can see Sheet-2 Column-A&amp;B does not have a combination of 1A &amp; 2A, hence we need to add this 12 times to Sheet-2.</p>
  
  <pre><code>      Sheet-1                              Sheet-2
  Column-A   Column-B                  Column-A  Column-B
     1           1                          1        1
     1A          2A                         1        4
                                            2B       3B
  </code></pre>
  
  <p>The following is the code I have written for checking if Column-A of Sheet-1 values exists in Sheet-2 or not then add the missing 12 times:</p>
  
  <pre><code>'Sub MergeMissing()
   Dim xlsData As Worksheet
   Dim xlsTracker As Worksheet
   Dim lngRowNumber As Long
   Dim lngTargetRow As Long
   Dim rngDataCell As Range
   Dim dctIndex As Object
   '# initialise
   Set xlsData = ThisWorkbook.Worksheets("Sheet-1")
   Set xlsTracker = ThisWorkbook.Worksheets("Sheet-2")
   Set dctIndex = CreateObject("Scripting.Dictionary")
   dctIndex.CompareMode = 1
   '# build index of existing values
   With xlsTracker
   lngTargetRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    For lngRowNumber = 1 To lngTargetRow
       If Not dctIndex.Exists(.Cells(lngRowNumber, "A").Value) Then
          dctIndex.Add .Cells(lngRowNumber, "A").Value, lngRowNumber
       End If
    Next lngRowNumber
   End With
   '# copy data that does not exist as yet
   With xlsData
    For lngRowNumber = 1 To .Cells(.Rows.Count, "A").End(xlUp).Row
       If Not dctIndex.Exists(.Cells(lngRowNumber, "A").Value) Then
          lngTargetRow = lngTargetRow + 1
          xlsTracker.Cells(lngTargetRow, "A").Value = .Cells(lngRowNumber,    "A").Value
          lngTargetRow = lngTargetRow + 1
          xlsTracker.Cells(lngTargetRow, "A").Value = .Cells(lngRowNumber, "A").Value
           lngTargetRow = lngTargetRow + 1
          xlsTracker.Cells(lngTargetRow, "A").Value = .Cells(lngRowNumber, "A").Value
          lngTargetRow = lngTargetRow + 1
          xlsTracker.Cells(lngTargetRow, "A").Value = .Cells(lngRowNumber, "A").Value
          lngTargetRow = lngTargetRow + 1
          xlsTracker.Cells(lngTargetRow, "A").Value = .Cells(lngRowNumber, "A").Value
          lngTargetRow = lngTargetRow + 1
          xlsTracker.Cells(lngTargetRow, "A").Value = .Cells(lngRowNumber, "A").Value
           lngTargetRow = lngTargetRow + 1
          xlsTracker.Cells(lngTargetRow, "A").Value = .Cells(lngRowNumber, "A").Value
          lngTargetRow = lngTargetRow + 1
          xlsTracker.Cells(lngTargetRow, "A").Value = .Cells(lngRowNumber, "A").Value
          lngTargetRow = lngTargetRow + 1
          xlsTracker.Cells(lngTargetRow, "A").Value = .Cells(lngRowNumber, "A").Value
       End If
    Next lngRowNumber
    End With
  
    End Sub
  </code></pre>