Excel VBA copy and paste loop with logic condition
Solved/Closed
Yogibearv
Posts
2
Registration date
Monday 20 October 2014
Status
Member
Last seen
21 October 2014
-
20 Oct 2014 à 19:34
Yogibearv - 28 Oct 2014 à 16:27
Yogibearv - 28 Oct 2014 à 16:27
Related:
- Vba to copy and paste a range multiple times based on cell value
- Copy paste loop vba - Best answers
- How to copy cell if condition is met and paste in another cell - Best answers
- Why cant i copy and paste on instagram ✓ - Instagram Forum
- Based on the cell values in cells b77 ✓ - Excel Forum
- Based on the values in cells b77 b88 ✓ - Excel Forum
- Insert a new sheet at the end of the tab names and paste the range names starting in cell a1. autofit columns a:b and name the worksheet as named ranges. ✓ - Excel Forum
- How to insert rows in excel automatically based on cell value without vba ✓ - Excel Forum
4 responses
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
28 Oct 2014 à 12:19
28 Oct 2014 à 12:19
Hi Yogibearv,
So you use a formula for D5, that makes more sense. Try this code:
Best regards,
Trowa
So you use a formula for D5, that makes more sense. Try this code:
Sub RunMe()
Dim lRow, x As Integer
lRow = Range("I" & Rows.Count).End(xlUp).Row
x = 6
Do
x = x + 1
Range("B" & x).Value = Range("I" & x).Value
Range("I" & x).ClearContents
Loop Until IsEmpty(Range("I" & x + 1)) Or x = lRow Or Range("D5").Value = "OK"
End Sub
Best regards,
Trowa