title: Run-time error 1004 while copy-pasting data
body: <p>I have written a macro to list down all the numbers between certain ranges and then to paste values against each number. The macro throws a Run-time error 1004. Here's the macro: </p>
  
  <pre><code>Sub Populate()
  Range("A1") = Range("H18").Value
  Range("A1").Select
  Selection.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
          Step:=1, Stop:=Range("I18").Value, Trend:=False
  
  Range("J18").Select
      Selection.Copy
      Range("B1").Select
      ActiveSheet.Paste
      Application.CutCopyMode = False
      Selection.Copy
      Range("A1").Select
      Selection.End(xlDown).Select
      Range("B20").Select
      Range(Selection, Selection.End(xlUp).Offset(-1, 0)).Select
      ActiveSheet.Paste
      Application.CutCopyMode = False
      Range("B1").Select
  
  Range("A1").End(xlDown).Offset(1, 0) = Range("H19").Value
  Range("A1").End(xlDown).Select
  Selection.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
          Step:=1, Stop:=Range("I19").Value, Trend:=False
  
  
  Range("J18").Select
      Selection.Copy
      Range("B1").Select
      ActiveSheet.Paste
      Application.CutCopyMode = False
      Selection.Copy
      Range("A1").Select
      Selection.End(xlDown).Select
      Range("B20").Select
      Range(Selection, Selection.End(xlUp).Offset(-1, 0)).Select
      ActiveSheet.Paste
      Application.CutCopyMode = False
      Range("B1").Select
  
   End Sub
  </code></pre>