Excel VBA copy and paste loop with logic condition
Solved/Closed
Yogibearv
Yogibearv - Oct 28, 2014 at 04:27 PM
- Posts
- 2
- Registration date
- Monday October 20, 2014
- Status
- Member
- Last seen
- October 21, 2014
Yogibearv - Oct 28, 2014 at 04:27 PM
Related:
- Vba to copy and paste rows if condition is met
- Copy and paste loop in vba based on cell values - Best answers
- Excel vba copy and paste cells if condition is met - Best answers
- Copy Row if condition is met - Forum - Office Software
- Compare files & Insert row per condition VBA ✓ - Forum - Programming
- Macro that copy/pastes rows based on a certain condition on SAME sheet. ✓ - Forum - Excel
- Excel vba cut and paste row to another sheet based on cell value - Forum - Excel
- Vba to copy and paste a range multiple times based on cell value ✓ - Forum - Excel
4 replies
TrowaD
Oct 28, 2014 at 12:19 PM
- Posts
- 2888
- Registration date
- Sunday September 12, 2010
- Status
- Moderator
- Last seen
- August 16, 2022
Oct 28, 2014 at 12:19 PM
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