title: Fix Subscript out of range VBA
body: <p>I am try to copy  formula and header contained in range &quot;T12:W13&quot; and paste it in the same cell location in all files in a folder. Cop to destination &quot;T12:W13&quot; then drag the formula all the way down close and save the sheet and then open next sheet till all the files in the folder are done.</p>
  <pre><code>Sub CopyRange()
  
  Application.ScreenUpdating = False
  
      Dim wkbDest As Workbook
      Dim wkbSource As Workbook
      Set wkbDest = ThisWorkbook
      Const strPath As String = &quot;C:\Users\kaii\Downloads\Jan 2022\&quot;
      ChDir strPath
      strExtension = Dir(&quot;*.xlsx*&quot;)
      Do While strExtension &lt;&gt; &quot;&quot;
          Set wkbSource = Workbooks.Open(strPath &amp; strExtension)
          With wkbSource
              .Sheets(&quot;Monthly&quot;).Range(&quot;T12:W13&quot;).Copy wkbDest.Sheets(&quot;XXTOLL_Collector_Invoice_*&quot;).Range(&quot;T12&quot;).Paste
              ActiveCell.AutoFill Range(ActiveCell, ActiveCell.Offset(0, -1).End(xlDown).Offset(0, 1))
              .Close savechanges:=False
          End With
          strExtension = Dir
      Loop
      Application.ScreenUpdating = True
      Application.CutCopyMode = False
  End Sub
  </code></pre>
  <p><a href="https://i.stack.imgur.com/aWCbk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aWCbk.png" alt="Excel Sheet for review" /></a></p>