ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   insert to hold data (https://www.excelbanter.com/excel-programming/296810-insert-hold-data.html)

Gav[_2_]

insert to hold data
 
morning all,

How would i alter an existing code the copies and pastes data so as to insert enough rows to hold the data that is pasted. The target is the last row within the print area and i would like the sheet to insert enough rows to hold the pasted data so that it will appear within the print area??

Cheers!!!!

KaiRich

insert to hold data
 
Hi Gav,

Sub TestRows()
Dim NumberOfRows
Dim LoopCounter
Worksheets(1).Activate
' Insert here your existing code to copy data:
NumberOfRows = Selection.Rows.Count
Worksheets(2).Activate
' Insert here code to select right place to insert
For LoopCounter = 1 To NumberOfRows
ActiveCell.EntireRow.Insert
Next
' Then insert you existing code to paste
End Sub

It will need some work to fit into your existing
situation, but I've tested it at this end.

Regards,
Kai


-----Original Message-----
morning all,

How would i alter an existing code the copies and pastes

data so as to insert enough rows to hold the data that is
pasted. The target is the last row within the print area
and i would like the sheet to insert enough rows to hold
the pasted data so that it will appear within the print
area??

Cheers!!!!
.



All times are GMT +1. The time now is 06:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com