insert to hold data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!!!!
 
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??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top