VBA macro to copy range and paste in next blank row
I'm trying to copy a named range and paste it two rows below. I want to retain all the source formatting and formulas and include all cells whether they are blank or not. I want to repeat this macro based on the cell value from J5. Here's what I have.
Sub Copy_Paste()
Dim i As Long
For i = 1 To Range("J5")
Range("oldroom").Copy
Range("A" & Rows.Count).End(xlUp).Offset(2, 0).PasteSpecial xlPasteValues
Next i
End Sub
It won't copy the blank rows. The named range includes 15 rows but it only copy/pastes the first two. The remaining rows have formulas but no values. This macro is supposed to allow the end user to enter a number in J5 to tell how many pages (each "oldroom" should be a page) to add. Additionally, I need the macro to insert a page break between each repeat of the macro. Any ideas? I've successfully tested the above macro by using it on a sheet with a simple 15 row, 3 column table with positive values in all representative cells, but it won't work on my template sheet where there are formulas and zero values aplenty.
|