title: Searching for matching cells and copying row data
body: <p>I'm very new to Visual Basic, so I apologize if this is a basic question.</p>
  
  <p>I have two excel documents, one with a list of company names and their corresponding identifying numbers (about 4000 in total). In a separate document, I have a list of people and who they work for (these are the same companies from the first document, but sometimes there will be more than one row per company, since we work with more than one person from that company). There are about 7000 entries here. I want to transfer all of the company ID numbers into the document with all of the company personnel. I have the concept for the code down, but unfortunately, I don't know enough about Excel VBA syntax to write this. I wrote some code, but it doesnt work and I don't know why.</p>
  
  <pre><code>Sub Firm_Number_Transfer()
      Dim i As Integer
      Dim x As Integer
      Dim row As Integer
      Dim oldRow As Integer
      Dim found As Boolean
  
      row = 1
      oldRow = 1
  
      For i = Workbooks("PM Firm Contacts - Step 2 - REVIEWED").Worksheets("Sheet2").Cells("B1") To Workbooks("PM Firm Contacts - Step 2 - REVIEWED").Worksheets("Sheet2").Cells("B7122") Step 1
          row = row + 1
          For x = Workbooks("PM Firms - Step 1 - REVEIWED").Sheets("Sheet1").Cells("B2") To Workbooks("PM Firms - Step 1 - REVEIWED").Sheets("Sheet1").Cells("B4843") Step 1
              oldRow = oldRow + 1
              If i = x Then
                  Workbooks("PM Firm Contacts - Step 2 - REVIEWED").Sheets("Sheet2").Cells(row, 1) = Workbooks("PM Firm Contacts - Step 2 - REVIEWED").Sheets("Sheet2").Cells(oldRow, 1)
                  found = True
              End If
          Next x
          found = False
          oldRow = 1
      Next i
  End Sub
  </code></pre>
  
  <p>Is there anything obvious that I'm missing? Any help is appreciated.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I should also add that the table is set up in such a way that the companies are on the right and the company numbers are on the left. From what I understand, <code>VLOOKUP()</code> only works if the companies are on the left and the company numbers i'm copying are on the right. Otherwise <code>VLOOKUP()</code> would be what I would use.</p>