title: Transfer Information from one file to a final one
body: <p>I need to develop a VBA code that brings information from a different file (3 different tabs) and combines everything into one final file.</p>
  <p>The final file looks like the table below. We have 7 columns (column 3, 4 and 7 have always the same value):
  <a href="https://www.dropbox.com/s/x0vd84ar5qh8dr3/CustomerAmendments.csv?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/x0vd84ar5qh8dr3/CustomerAmendments.csv?dl=0</a></p>
  <p>The file from where the information is coming has the previous view:
  <a href="https://www.dropbox.com/scl/fi/zii79x0i01wbsti1vfr9c/Combined-amendments.xlsm?dl=0&amp;rlkey=s0oy0uy26ej3fwhewzfd2zyct" rel="nofollow noreferrer">https://www.dropbox.com/scl/fi/zii79x0i01wbsti1vfr9c/Combined-amendments.xlsm?dl=0&amp;rlkey=s0oy0uy26ej3fwhewzfd2zyct</a></p>
  <p>Steps of the macro:</p>
  <p>1- Filter in tabs &quot;NI&quot; and &quot;ROI&quot; column R by &quot;C&quot; and copy the information from columns C, D, I and P;</p>
  <p>2- Filter in tab &quot;OCADO&quot; column Q by &quot;C&quot; and copy the information from columns C, D, I and O;</p>
  <p>3- Paste information on the final file according with by column order shown in the final file.</p>
  <p>I developed the below code but I get an error could you please have a look?</p>
  <pre><code>   Sub CustomerAmends()
  Dim sh As Worksheet, ary As Variant, i As Long
  Set sh = Workbooks(&quot;X:\Planning\production plans\production plans\Order Amendments\Combined amendments.xlsm&quot;).Sheets(1) 
  
  ary = Array(&quot;NI&quot;, &quot;ROI&quot;, &quot;OCADO&quot;)
      For i = LBound(ary) To UBound(ary)
          With Sheets(ary(i))
              .UsedRange.AutoFilter 17, &quot;C&quot;
              .Range(&quot;C2&quot;, .Cells(Rows.Count, 3).End(xlUp)).Copy sh.Cells(Rows.Count, 5).End(xlUp)(2)
              .Range(&quot;D2&quot;, .Cells(Rows.Count, 4).End(xlUp)).Copy sh.Cells(Rows.Count, 1).End(xlUp)(2)
              .Range(&quot;I2&quot;, .Cells(Rows.Count, 9).End(xlUp)).Copy sh.Cells(Rows.Count, 6).End(xlUp)(2)
                  If i &lt;&gt; UBound(ary) Then
                      .Range(&quot;P2&quot;, .Cells(Rows.Count, 16).End(xlUp)).Copy sh.Cells(Rows.Count, 2).End(xlUp)(2)
                  Else
                      .Range(&quot;O2&quot;, .Cells(Rows.Count, 15).End(xlUp)).Copy sh.Cells(Rows.Count, 2).End(xlUp)(2)
                  End If
              .AutoFilterMode = False
          End With
      Next
  End Sub
  </code></pre>
  <p>Thank you! :)</p>