title: VBA vlookup using Excel reference table in external workbook
body: <p>Right now, I'm using this type of code to look at what's in column O to determine what to enter in column N. Since the data is confidential, I'm just making it letters and numbers here. It works fine, but instead of hardcoding the cases in the VBA code, I want it to reference a table that is in an external workbook because I'm going to have thousands of cases and values to insert.</p>
  
  <pre><code>Sub ChangeTest()
      Dim LastRow As Long
      Dim i As Long
        LastRow = Range("O" &amp; Rows.Count).End(xlUp).Row
        For i = 2 To LastRow
          Select Case Range("O" &amp; i)
            Case "A", "B", "C"
              Range("N" &amp; i) = "1"
            Case "D","E","F"
              Range("N" &amp; i) = "2"
            Case "G","H","I"
              Range("N" &amp; i) = "3"
          End Select
        Next i
  End Sub
  </code></pre>
  
  <p>In the external workbook, column D will contain the cases (A, B, C, etc.) and column C will have the number (1, 2, 3, etc.) that is to go into column N in the original workbook.</p>
  
  <p>I'm not sure if the code I have now needs to be edited slightly to incorporate the reference table or if it's going to need to be completely different.</p>