title: copying 12 diffrent workbooks to one, any way to optimize the code and make it run faster?
body: <p>I need to open 12 different workbooks copy the data to 1 workbook in 12 sheets and make each range a table, any way to make the code faster than what I wrote?
  all workbooks are in one shared folder, mixed with different workbooks that do not need to be opened.
  The current run time is 20 seconds</p>
  <pre><code>Sub callstuff()
  
  Application.ScreenUpdating = False
      Application.Calculation = xlCalculationManual
  Call CurrentRegionArray(&quot;helper1&quot;, &quot;book2.xlsx&quot;, &quot;sheet2&quot;, &quot;J4&quot;)
  Call CurrentRegionArray(&quot;helper2&quot;, &quot;book3.xlsx&quot;, &quot;sheet3&quot;, &quot;J4&quot;)
  Call CurrentRegionArray(&quot;helper3&quot;, &quot;book4.xlsx&quot;, &quot;sheet4&quot;, &quot;J4&quot;)
  Call CurrentRegionArray(&quot;helper4&quot;, &quot;book5.xlsx&quot;, &quot;sheet5&quot;, &quot;J4&quot;)
  Call CurrentRegionArray(&quot;helper5&quot;, &quot;book6.xlsx&quot;, &quot;sheet6&quot;, &quot;J4&quot;)
  Call CurrentRegionArray(&quot;helper6&quot;, &quot;book7.xlsx&quot;, &quot;sheet7&quot;, &quot;J4&quot;)
  Call CurrentRegionArray(&quot;helper7&quot;, &quot;book8.xlsx&quot;, &quot;sheet8&quot;, &quot;J4&quot;)
  Call CurrentRegionArray(&quot;helper8&quot;, &quot;book9.xlsx&quot;, &quot;sheet9&quot;, &quot;J4&quot;)
  Call CurrentRegionArray(&quot;helper9&quot;, &quot;book10.xlsx&quot;, &quot;sheet10&quot;, &quot;J4&quot;)
  Call CurrentRegionArray(&quot;helper10&quot;, &quot;book11.xlsx&quot;, &quot;sheet11&quot;, &quot;J4&quot;)
  Call CurrentRegionArray(&quot;helper11&quot;, &quot;book12.xlsx&quot;, &quot;sheet12&quot;, &quot;J4&quot;)
  Application.Calculation = xlCalculationAutomatic
  Application.ScreenUpdating = True
  End Sub
  
  Sub CurrentRegionArray(TableName As String, WorkBookName As String, SheetName As String, RangeName As String)
      
  
  
          Dim strPath As String
          strPath = &quot;/Users/dimagoroh/Desktop/nastia stuff &quot;
          Application.Workbooks.Open (strPath &amp; &quot;/&quot; &amp; WorkBookName)
  
  'copy range to array and copy that array to diffrent sheet
      With Workbooks(&quot;book1.xlsm&quot;).Worksheets(SheetName).Range(RangeName)
           oarray = Workbooks(WorkBookName).Worksheets(&quot;sheet1&quot;).ListObjects(&quot;leavetracker&quot;).DataBodyRange.Value
          .CurrentRegion.Clear
          .Resize(UBound(oarray, 1), UBound(oarray, 2)) = oarray
      End With
  
  
  'Seting range as table and giving it a name
  
  Dim rngTable As Range
  
      With Workbooks(&quot;book1.xlsm&quot;).Worksheets(SheetName)
              Set rngTable = .Range(RangeName).CurrentRegion
              .ListObjects.Add(xlSrcRange, rngTable, , xlYes).Name = TableName
      End With
      
  Workbooks(WorkBookName).Close
  Erase oarray
  
  End Sub
  </code></pre>