title: vba to insert row at bottom of data range and copy formatting and formulas not working
body: <p>I have some code which works perfectly apart from the fact that it copies the content of the above cells as well. I'd like the cells to be inserted empty with the formulas only. </p>
  
  <p>I'd also like another button that removes unused rows...is this possible before i try and figure out the code for that? </p>
  
  <p><a href="https://i.stack.imgur.com/luAUH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/luAUH.png" alt="enter image description here"></a></p>
  
  <p>i have tried inserting rows.clear but this cleared every row in the whole spreadsheet! 
  I tried inserting this line and similar variations in different areas of the code and i cant get it to work..</p>
  
  <pre><code>
    Dim i As Long, n As Variant
    n = InputBox("How many rows:", "INSERT ROWS")
    If n = "" Or Not IsNumeric(n) Or n &lt; 1 Then Exit Sub
    If Int(n) &lt; Val(n) Then Exit Sub
    i = 15
    Do While Cells(i, "B") &lt;&gt; ""
      i = i + 1
    Loop
    Rows(i &amp; ":" &amp; i + n - 1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Rows(i - 1 &amp; ":" &amp; i - 1).Copy
    Rows(i &amp; ":" &amp; i + n - 1).PasteSpecial Paste:=xlPasteFormulas
    Rows(i &amp; ":" &amp; i + n - 1).PasteSpecial Paste:=xlPasteFormats
    Application.CutCopyMode = False
    End Sub
  </code></pre>
  
  <p>i need the button to insert a specified number of rows at the bottom of the data range that is empty with the correct formulas and formatting. 
  It works perfectly apart from the rows have copied the content of the cell above as well. 
  <em>please note if the contents from B, G and H are removed this will clear the row as these cells do not have formulas in them</em>
  I'd also like a button that removes empty unwanted rows from the bottom of the data range. </p>
  
  <p>I have also noticed that i can't undo the inserted rows...is there a piece of code that enables the undo function?</p>