samztheman
New Member
- Joined
- Feb 15, 2021
- Messages
- 5
- Office Version
- 365
- Platform
- Windows
Hey, I'm having a lot of trouble copying multiple rows from one sheet to paste under a specific row in another sheet. (but the row # is not static, hence why I want to use a text condition "Deliverables"
Basically, I want to be able to build a macro button that will add these rows whenever the user clicks it, so it can just continually add those rows to their hearts desire. Its important that it can do it multiple times, and always add the new copied rows under the text conditioned row.
I'm able to do a single row with:
Sheets("Sheet1").Rows(5).EntireRow.Copy Sheets("Template").Cells(Sheets("Template").Range("A:M").Find("Deliverables", LookIn:=xlValues, lookat:=xlWhole).Row + 1, 1)
However, it only copies 1 row, can't stack it by just copying the code but changing row 5 to say row 4, and it can't be selected multiple times(it only adds it once, no looping)
To recap, I want to be able to :
1) Copies 5 rows from sheet 1.
2) Always Inserts rows below a specific row in Template sheet, containing the cell value "Deliverables".
3) Keep all existing formatting and the data validation list I have in that( I assume that if its a direct copy/paste, it will keep the formatting and drop-down list.
4) Be able to run macro and it continually adds these rows, even if I add a ton of rows above the deliverables section.
I've seen similar questions on other threads, but they don't quite do what I'm looking for(copy/paste a specific set of rows, onto another worksheet, and always under the row with the cell containing the value "Deliverables", and nowhere else.
Trying to piecemeal existing code from threads hasn't fully worked. The closest I got was one that would copy/paste only one row, but then it can't be looped.
I have the code to do what I want in a static sheet(Where i am not manually adding rows above).
Below are an image of the sheet I am copying to, and an image of the rows I am trying to copy/paste.
Thank you so much for anyone able to answer, total lifesaver.
Basically, I want to be able to build a macro button that will add these rows whenever the user clicks it, so it can just continually add those rows to their hearts desire. Its important that it can do it multiple times, and always add the new copied rows under the text conditioned row.
I'm able to do a single row with:
Sheets("Sheet1").Rows(5).EntireRow.Copy Sheets("Template").Cells(Sheets("Template").Range("A:M").Find("Deliverables", LookIn:=xlValues, lookat:=xlWhole).Row + 1, 1)
However, it only copies 1 row, can't stack it by just copying the code but changing row 5 to say row 4, and it can't be selected multiple times(it only adds it once, no looping)
To recap, I want to be able to :
1) Copies 5 rows from sheet 1.
2) Always Inserts rows below a specific row in Template sheet, containing the cell value "Deliverables".
3) Keep all existing formatting and the data validation list I have in that( I assume that if its a direct copy/paste, it will keep the formatting and drop-down list.
4) Be able to run macro and it continually adds these rows, even if I add a ton of rows above the deliverables section.
I've seen similar questions on other threads, but they don't quite do what I'm looking for(copy/paste a specific set of rows, onto another worksheet, and always under the row with the cell containing the value "Deliverables", and nowhere else.
Trying to piecemeal existing code from threads hasn't fully worked. The closest I got was one that would copy/paste only one row, but then it can't be looped.
I have the code to do what I want in a static sheet(Where i am not manually adding rows above).
Below are an image of the sheet I am copying to, and an image of the rows I am trying to copy/paste.
Thank you so much for anyone able to answer, total lifesaver.