Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-03-2014, 08:25 PM
tune2grow tune2grow is offline VBA macro to copy range and paste in next blank row Windows Vista VBA macro to copy range and paste in next blank row Office 2007
Novice
VBA macro to copy range and paste in next blank row
 
Join Date: Sep 2014
Posts: 1
tune2grow is on a distinguished road
Default 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.
Reply With Quote
Reply

Tags
add page breaks, copy blanks, repeat macro

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA macro to copy range and paste in next blank row Paste Special: Copy and Paste Formatting Only? tinfanide Word 6 03-06-2013 12:21 AM
VBA macro to copy range and paste in next blank row How to do an automation for copy paste, added new row (macro) jpol Excel Programming 1 03-01-2013 05:53 AM
VBA macro to copy range and paste in next blank row how to cut and paste for the range tomlam Excel Programming 5 12-26-2012 02:20 AM
VBA macro to copy range and paste in next blank row copy a range including shapes Marcus Excel Programming 8 08-17-2012 01:50 AM
VBA macro to copy range and paste in next blank row How to remove blank rows from a specified range? Learner7 Excel 1 04-19-2011 02:45 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:24 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft