title: Copying Rows in For Loop and Pasting to new Sheet
body: <p>I am having problems copy/pasting rows based on criteria. </p>
  
  <pre><code>Dim lastrow1 As Long
  Dim lastcolumn1 As Long
  Dim Distance As Long
  Distance = 14
  Set sh = ThisWorkbook.Sheets("Sample Address Database")
  Set sh2 = ThisWorkbook.Sheets("Workspace")
  lastrow1 = sh.Cells(Rows.Count, "A").End(xlUp).row
  lastcolumn1 = sh.Cells(1, Columns.Count).End(xlToLeft).Column
  
  Dim L As Long
  For L = 2 To lastrow1
      If _
      sh.Cells(L, Distance).Value &lt;= CDbl(cboRadius.Value) Then
          sh.Range("A" &amp; L &amp; ":" &amp; lastcolumn1 &amp; L).Copy _
          Destination:=sh2.Range("A" &amp; L)
      End If
  Next
  </code></pre>
  
  <p>cboRadius.Value is a number from a userform (there is no problem with that line.) </p>
  
  <p>Whenever I try to run this code, I get a "Run-time error '1004': Method 'Range' of object '_Worksheet' failed, with the yellow arrow pointing to the destination line. What is the problem?</p>
  
  <p><strong>EDIT:</strong>
  Ed Heywood-Lonsdale suggested I change</p>
  
  <pre><code>sh.Range("A" &amp; L &amp; ":" &amp; lastcolumn1 &amp; L).Copy _
  </code></pre>
  
  <p>To </p>
  
  <pre><code>sh.Range("A" &amp; L &amp; ":A" &amp; lastcolumn1 &amp; L).Copy _
  </code></pre>
  
  <p>Now only column A, or if I change it to B, C, D, etc. is being copied. I think the problem is that it may not be registering that lastcolumn1 and L are column/row numbers and is instead making them one value, thus causing a range malfunction.</p>