Justin, thanks for showing me an alternative at least.
Posts by RRM1


Solved. I took your code and remodified it to value paste the series of data into sheet 2, as a sequence once the condition is met. This gives me the desired outcome. Thanks again for your guidance.
Code Sub Test2()
 Dim i As Long, lCol As Long
 With Sheet1
 lCol = .Cells(5, .Columns.Count).End(xlToLeft).Column
 For i = 1 To lCol  13
 Do
 DoEvents
 Application.Calculate
 Loop Until .Cells(1, 1).Value = "True"
 Sheets(1).Range("C5:C7").Value = .Range("M5:M7").Offset(, i).Value
 If i > 1 Then Sheets(2).Range("A1:A3").Offset(0, i).Value = Sheets(1).Range("M5:M7").Offset(0, i).Value
 Next i
 End With
 End Sub

Thanks for the feedback. I tried to manipulate your code to generate the range of numbers in sheet 2 only as a sequence as how they were displayed in sheet 1, once the condition is met but, I failed.
What I want to achieve is to copy the range of numbers in each column starting from sheet 1, column N5:N7 then paste it into column C, C5:C7. Once the condition is TRUE looking at sheet 1, A1 then this range of numbers are value pasted into sheet 2, A1:A3. The iteration starts over again and moves to the next column in sheet 1, that is O5:O7 and does the same thing by pasting in C5:C7 this range of numbers and once the condition is met then it value paste that range into sheet 2, B1:B3 etc. This continues for each column of data until a blank column is met in sheet 1. The code ends then.
I failed to modify your code. I want to achieve pasting each separate column range of numbers in sheet 2 only as a sequence to each other and and also to ensure the condition set is a reflection of each range of numbers pasted into sheet 1, C11. Hope this is clearer or at least let me know. Thanks in advance. My failed attempt at code below
Code 1. Sub Test()
 2. Dim i As Long, lCol As Long
 3. With Sheet1
 4 lCol = .Cells(5, .Columns.Count).End(xlToLeft).Column
 5. For i = 1 To lCol  13
 6. Do
 7. DoEvents
 8. Application.Calculate
 9. Sheet1.Range("N5:N7").Copy Sheet1.Range("C5:C7").Offset(, i)
 10. Loop Until .Cells(1, 1).Value = "True"
 11. Sheet2.Cells.Range("C5:C7").Value = Sheet1.Range("M5:M7").Offset(, i).Value
 12. Next i
 13 End With
 14. End Sub

Hi, this is a request for a new sub routine. I've attached a template for the steps and dummy data that I would like to simulate.
I have multiple columns of random data (3 rows each) from columns N to column T or at least until there is an empty column range in sheet1. I want to copy and paste the first column data ( 3 rows) in column N and paste it to say sheet 1, cell C5 then my model runs until a condition is met and paste results in the next sheet2. Once that condition is met, then I want to get next column data (3 rows) from column N and paste over the data in cell C5 and the model runs until same condition is met again etc. This goes on until a blank column is met in sheet1 then stops.
Thanks in advance.

Thanks for the redirection. Posted as a new thread.

Hi, could I ask for further assistance with code? I am not sure if this is a new thread but it is meant to appendix the above code in my model.
This will be a new sub routine.
I have multiple columns of data (3 rows each) from columns M to column U or at least until there is an empty column range in sheet1. I want to copy and paste the first column data ( 3 rows) in column N and paste it to say sheet 1, cell C5 then my model runs until a condition is met and paste results in the next sheet2. Once that condition is met, then I want to get next column data (3 rows) from column N and paste over the data in cell C5 and the model runs until same condition is met again etc. This goes on until a blank column data is met in sheet1 then stops.
If this is in violation of the forum rules please let me know, I'll understand. Thanks in advance.


Good day,
I have code that looks at the values generated from a random generator and once a condition is met then it stops. For example, it counts the numbers generated (for example 1, 2, 3) in range P1:P3 and once the condition value set in sheet1, A1 is met > 2, then it stops.
I would like to go further by running more iterations. That is once condition is met in sheet 1, A1 then it copy and paste values sheet 1, P1:P3 into sheet2, A1:A3 then goes back to sheet 1 and reruns the below code. I would like to do this 10 times. Each time condition is met then it copy and paste value into sheet2, in next available column, B1:B3 then C1:C3 until sheet2, J1:J3 is populated with a range then END. Is there a nested DO UNTIL LOOP, IF THEN to use? I have no clue and appreciate guidance.

Hi, I have a function that generates a random number range based on a condition so I would like to copy the column range of these numbers (say column B1:B10) and paste it to another column in the same worksheet (say F1:10) once the condition is met and continue to copy the same column range (B1:B10) after the next iteration condition is met and paste into the next blank column (G1:G10) until 10 iterations, that is columns F to O are populated with the data range from column B1:B10. Is there a code I can perform this with? Thanks in advance.