title: Loop Copy Paste at specific interval
body: <p>I'm a beginner and trying to run a vba which does this: </p>
  
  <ul>
  <li>copy a formula from a starting point (cell B6) </li>
  <li>paste this formula every 18 rows down on the same column </li>
  <li>repeat the process until the cell says "End of Report" </li>
  </ul>
  
  <p>I have the following code and I can't make it run properly (inherited formula only from an existing report): </p>
  
  <pre><code>'(a) to set the formula at starting point: 
          Windows("RAVEN MNL adj.xlsm").Activate
          Range("B6").Select
          ActiveCell.FormulaR1C1 = "=TRIM(RIGHT(RC[-1],7))"
  
  '(b) to copy paste in loop 
          Dim i As Long
          Dim ii As Long
          Dim strLastCell As Long
          Dim rng As Range
  
          Set rng = Range("B:B").Cells
  
          strLastCell = rng.Find(what:="End of Report", After:=rng.Cells(1), Lookat:=xlPart, LookIn:=xlFormulas, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False).Row
  
          ii = i + 18
          i = ActiveCell.Select
  
          For ii = i To strLastCell
          Range("B6").Copy
          Range("B" &amp; ii).Paste
          Next ii
          End Sub
  </code></pre>
  
  <p>The error seems to be at the "strLastCell" bit. Can you help? </p>