Copying a row based on a integer in a cell
Solved/Closed
Sheepy_777
Posts
3
Registration date
Wednesday 16 February 2022
Status
Member
Last seen
23 February 2022
-
16 Feb 2022 à 11:48
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 24 Feb 2022 à 11:43
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 24 Feb 2022 à 11:43
Related:
- Xtxt8
- How to delete a row in a table in word - Guide
- Saints row 2 cheats - Guide
- 64 bit integer - Guide
- Protect pdf from copying - Guide
- Based on the values in cells b77 b88 ✓ - Excel Forum
2 responses
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
17 Feb 2022 à 12:10
17 Feb 2022 à 12:10
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 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
22 Feb 2022 à 11:42
22 Feb 2022 à 11:42
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 16 February 2022
Status
Member
Last seen
23 February 2022
23 Feb 2022 à 15:28
23 Feb 2022 à 15:28
THANK YOU SO MUCH! i made a couple adjustments to it but it works PERFECTLY!
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
>
Sheepy_777
Posts
3
Registration date
Wednesday 16 February 2022
Status
Member
Last seen
23 February 2022
24 Feb 2022 à 11:43
24 Feb 2022 à 11:43
Awesome, thanks for the feedback!
21 Feb 2022 à 10:12
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.