Excel VBA copy and paste loop with logic condition
Solved/Closed
                    
        
                    Yogibearv
    
        
                    Posts
            
                
            2
                
                            Registration date
            Monday October 20, 2014
                            Status
            Member
                            Last seen
            October 21, 2014
            
                -
                            Updated on Jan 30, 2019 at 08:33 AM
                        
Yogibearv - Oct 28, 2014 at 04:27 PM
        Yogibearv - Oct 28, 2014 at 04:27 PM
        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
- How to insert rows in excel automatically based on cell value without vba ✓ - Excel Forum
- Vba matrix multiplication - Excel Forum
- Invisible discord name copy and paste ✓ - Internet & Social Networks Forum
4 responses
                
        
                    TrowaD
    
        
                    Posts
            
                
            2921
                
                            Registration date
            Sunday September 12, 2010
                            Status
            Contributor
                            Last seen
            December 27, 2022
            
            
                    555
    
    
                    
Oct 28, 2014 at 12:19 PM
    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
