title: Copy Paste Range using LastRow
body: <p>I have a question on how to copy a formula from a certain specified range to a specified FirstRow to LastRow if from <code>A7</code> onward until LastRow the rows have data.</p>
  
  <p>If from <code>A7</code> until LastRow has Data, the formula from <code>H6:J6</code> should be pasted as formula from <code>H7:J7</code> until LastRow.</p>
  
  <p>Now the problem is if from <code>A7</code> onward the rows are empty, it will copy the formula in <code>H5:J5</code>. Is there a code I can use so that if <code>A7</code> onward is empty that no formula is copied at all? Perhaps Define the FirstRow as fixed or something.</p>
  
  <pre><code>Sub CopyFormulaIF()
  
  Dim myLastRow As Long
  Dim myCol As Long
  Dim WB As Workbook
  Dim WS As Worksheet
  
  Set WB = ThisWorkbook
  Set WS = WB.Sheets("Tabelle1")
  
  'Screen update in 0 seconds
  Application.ScreenUpdating = 0
  
  With WS
      myLastRow = .Range("A" &amp; .Rows.Count).End(xlUp).Row
  End With
  
  For myCol = 8 To 10                                              
      Cells(6, myCol).Copy                                        
      Range(Cells(7, myCol), Cells(myLastRow, myCol)).PasteSpecial Paste:=xlFormulas 
  Application.CutCopyMode = False                             
  Next myCol
  
  End Sub
  </code></pre>
  
  <p>Sample:
  <a href="https://i.stack.imgur.com/QTibh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QTibh.jpg" alt="enter image description here"></a></p>
  
  <p>Thanks a lot guys</p>