title: How can I use LastRow on a range function?
body: <p>So I want to copy values from a certain range of cells from worksheet 1-workbook A to worksheet 1- workbook B . </p>
  
  <p>I want to copy everything from the source worksheet: more specifically, every cell that has a value on it.</p>
  
  <p>On the destination worksheet, there are specified cells for the values on source worksheet.</p>
  
  <p>this is my code so far (it's bad, but i'm a noob at VBA!) :</p>
  
  <pre><code>Sub CopyRangeofCells()
  Dim x As Workbook
  Dim y As Workbook
  
  
  
  Set x = Workbooks.Open("C:\test\template.xlsx")
  Set y = Workbooks.Open("C:\test\finalfile.xlsx")
  
  
  x.Sheets("RDBMergeSheet").Range("A1").Copy
  
  
  y.Sheets("CW Fast").Range("A1").PasteSpecial
  
  'Close x:
  x.Close
  
  End Sub
  </code></pre>
  
  <p>On my range, I want to do something like Range("A1:LastRow") or anything of the sort. How do I do it? Can I create a lastrow variable and then do ("A1:mylastrowvariable") ?? </p>
  
  <p>Hope you can help! VBA is so confusing to me, give me Java all day long! :P</p>