Copying a row based on a integer in a cell
Solved/Closed
Sheepy_777
Posts
3
Registration date
Wednesday February 16, 2022
Status
Member
Last seen
February 23, 2022
-
Feb 16, 2022 at 11:48 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Feb 24, 2022 at 11:43 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Feb 24, 2022 at 11:43 AM
Related:
- Copying a row based on a integer in a cell
- How to delete a row in a table in word - Guide
- C++ 64 bit integer - Guide
- Saints row 2 cheats - Guide
- Protect pdf from copying - Guide
- Insert a function in cell b2 to display the current date from your system. ✓ - Excel Forum
2 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Feb 17, 2022 at 12:10 PM
Feb 17, 2022 at 12:10 PM
Hi Sheepy,
Could you show some sample data of how your data looks now and how you want it to look after runnning the code?
Best regards,
Trowa
Could you show some sample data of how your data looks now and how you want it to look after runnning the code?
Best regards,
Trowa
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Feb 22, 2022 at 11:42 AM
Feb 22, 2022 at 11:42 AM
Hi Sheepy,
Here is a different code for you to try:
Best regards,
Trowa
Here is a different code for you to try:
Sub RunMe() Dim lRow, x, y As Long Application.ScreenUpdating = False lRow = Range("A1").End(xlDown).Row For x = lRow To 2 Step -1 y = Cells(x, "J").Value Do y = y - 1 Range(Cells(x, "A"), Cells(x, "G")).Copy Cells(x + 1, "A").Insert shift:=xlDown Range(Cells(x, "I"), Cells(x, "AB")).Copy Cells(x + 1, "I").Insert shift:=xlDown Cells(x + 1, "H").Insert shift:=xlDown Cells(x + 1, "D").Value = "Pallets" Loop Until y = 0 y = Cells(x, "G").Value Do y = y - 1 Range(Cells(x, "A"), Cells(x, "G")).Copy Cells(x + 1, "A").Insert shift:=xlDown Range(Cells(x, "I"), Cells(x, "AB")).Copy Cells(x + 1, "I").Insert shift:=xlDown Cells(x + 1, "H").Insert shift:=xlDown Loop Until y = 1 Next x Application.ScreenUpdating = True End Sub
Best regards,
Trowa
Sheepy_777
Posts
3
Registration date
Wednesday February 16, 2022
Status
Member
Last seen
February 23, 2022
Feb 23, 2022 at 03:28 PM
Feb 23, 2022 at 03:28 PM
THANK YOU SO MUCH! i made a couple adjustments to it but it works PERFECTLY!
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
>
Sheepy_777
Posts
3
Registration date
Wednesday February 16, 2022
Status
Member
Last seen
February 23, 2022
Feb 24, 2022 at 11:43 AM
Feb 24, 2022 at 11:43 AM
Awesome, thanks for the feedback!
Feb 21, 2022 at 10:12 AM
The First image is the beginning of the whole process. I am needing each row to be copied X amount of times based on the integer in column 7 and column 10. But when it copies each line i need it to ignore column 8. And when we copy based on column 10 i need column 4 to say Pallets not Pieces. Second image shows what the finish product should Look like.