Copy row and it's contents based on value in X cell.
Closed
vmvmvmdew
Posts
1
Registration date
Wednesday January 25, 2017
Status
Member
Last seen
January 25, 2017
-
Updated by Ambucias on 25/01/17 at 05:09 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jan 26, 2017 at 11:40 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jan 26, 2017 at 11:40 AM
Related:
- Based on the values in cells b77:b81
- Code to move rows into another sheet based on certain values ✓ - Excel Forum
- Excel macro to create new sheet based on value in cells - Guide
- Instagram account based in wrong country - Instagram Forum
- Insert picture in Excel macro which takes the file name refrence - Excel Forum
- Based on the values in cells b77:b81, what function can automatically return the value in cell c77 ✓ - Excel Forum
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Jan 26, 2017 at 11:40 AM
Jan 26, 2017 at 11:40 AM
Hi vmvmvmdew,
Welcome to the forum!
You explained well, although your mini table doesn't make much sense if it just subtracts one. Why not use formula in I11: =H11-1?
Give the code below a try and see if it yields the desired result:
Best regards,
Trowa
Welcome to the forum!
You explained well, although your mini table doesn't make much sense if it just subtracts one. Why not use formula in I11: =H11-1?
Give the code below a try and see if it yields the desired result:
Sub RunMe() Dim x, y, z As Integer y = 11 Do Until Range("I" & y) = vbNullString x = Range("I" & y).Value z = x Do Until x = 0 Rows(y).Copy Rows(y).Insert shift:=xlUp x = x - 1 Loop y = y + z + 1 Loop Application.CutCopyMode = False End Sub
Best regards,
Trowa