title: VBA Loop to Copy a Dynamic Range
body: <p>I am attempting to create code in VBA that will cycle through a list of data, which changes weekly, and copies the data to another workbook. The number of columns will not change (A through E). There will always be five columns. However, the number of rows will change given the number of products sold. For each day of the week, the products sold is to be copied. I am still relatively new to VBA and haven't the slightest clue on how to set it up. This is the start of the code I was trying to write, but I have no clue what to do. Thanks in advance.</p>
  
  <pre><code>Sub ProdSold()
  
  Dim T As Workbook
  Dim Y As Workbook
  Dim J As Integer
  Dim V As Variant
  Dim R As Range
  Dim LastRow As Integer
  
  J = InputBox("Please enter the number of products sold.")
  LastRow = Range("A1").End(xlDown).Row
  
  Set T = Workbooks.Open("Filename")
  Set Y = ThisWorkbook
  
  For X = 1 To LastRowX Step J
      V = Y.Sheets("Sheet1").Range("A" &amp; X &amp; ":" &amp; "E" &amp; J)
  Next
  
  End Sub
  </code></pre>