title: How to copy values from an array and paste it in another sheet based on a condition?
body: <p>In a sheet named "Import" I have an array of two columns which I have named "test123". In the first column I have a lot of unique IDs, while the second displays the conversation number (NR). The data can be illustrated like this:</p>
  
  <pre><code> ID    NR
  1234    1
  2234    1
  4556    2
  8965    2
  5556    2
  6789    2
  2221    3
  2145    3
  9876    3
  </code></pre>
  
  <p>Further, I have an array with conversation numbers I want to show in another sheet named "Output". E.g. I want to extract the IDs for conversation number 2. I want this code to paste these values in the sheet "Output" with the first value in F6. </p>
  
  <p>Until now I am able to paste all values from the whole array. In cell B15 (in the "output" sheet) I have the name of the array. Had to do this since the array will change. In A20:A30 ("Output" sheet) I have the conversation numbers I want to show. </p>
  
  <pre><code>Private Sub CommandButton2_Click()
  
  Dim xRng As Range
  Dim xLastRow As Long
  Dim xLastRow2 As Long
  Dim i As Integer
  On Error Resume Next
  
  Set xRng = Worksheets("Import").Range(Range("B15"))
  If xRng.Value = Worksheets("Output").Range("A20:230").Value Then
  xRng.Copy Range("F6")
  xLastRow = xRng.Rows.Count + 1
  End If
  
  End Sub
  </code></pre>
  
  <p>Do someone have any suggestions to this problem?</p>