New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

Using a macro to copy rows and import them after the last row

Macros, VBA, Excel Automation, etc.

Using a macro to copy rows and import them after the last row

Postby Jamidd1 » Wed Feb 17, 2016 7:52 am

Hi

I am currently using the following code to copy 11 rows in my spreadsheet and paste them at the bottem. Each group of 11 rows represents a student and everytime i insert a new bunch this represents a new student.

Code: Select all
Sub InsertRows(): Dim R As Range
Set R = Rows.Find("*", , , , xlByRows, xlPrevious)
With ActiveSheet
.Rows("10:14").Copy
R.Offset(1, 0).EntireRow.Insert
End With
End Sub


I was wondering if i could adapt this so that it moves all formulas row number down by 5 each time i do the insert?

I hope this makes sense i am not very good with the Excel terminology!

I look forward to peoples answers.

Thanks

James
  • 0

Jamidd1
Rookie
 
Posts: 1
Joined: Feb 17, 2016
Reputation: 0
Excel Version: 2016

Re: Using a macro to copy rows and import them after the last row

Postby NoSparks » Wed Feb 17, 2016 11:29 am

Sorry I don't follow what you're trying to do.
I am currently using the following code to copy 11 rows in my spreadsheet and paste them at the bottem.

You only copy 5 rows (10 thru 14) and you use insert instead of paste.
Also, an entire row is 16,384 cells, do you really need to copy all of them?

Perhaps you can elaborate on what exactly you're trying to achieve.

Attaching a de-sensitized sample workbook, indicating what you are starting with and what you want to end up with would be helpful.
  • 0

NoSparks
Excel Hobbyist
 
Posts: 637
Joined: May 28, 2014
Reputation: 103
Excel Version: 2010


Return to Macros and VBA Questions

Who is online

Users browsing this forum: Google [Bot] and 17 guests