Copy row and it's contents based on value in X cell.
Closed
vmvmvmdew
Posts
1
Registration date
Wednesday 25 January 2017
Status
Member
Last seen
25 January 2017
-
25 Jan 2017 à 07:18
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 26 Jan 2017 à 11:40
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 26 Jan 2017 à 11:40
Related:
- Based on the values in cells b77
- Name Values - Excel Forum
- Code to move rows into another sheet based on certain values ✓ - Excel Forum
- Based on the values in cells b77 b81 c77 - Excel Forum
- How do I get a value in a cell based on another cell - Excel Forum
- Looking For a Value in a Cell - Excel Forum
1 response
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
26 Jan 2017 à 11:40
26 Jan 2017 à 11:40
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

