I want the code to read the value of 'vResults(1, i)' and if it is greater than 21, I want it to increase the value of 'vInputs(5, i)' by 1 and keep doing that until 'vResults(1, i)' is greater than 21.
Doesn't give out any errors, but Excel just crashes.
Sub CreateTestResultTableV2()
Application.ScreenUpdating = False 'helps the code run faster
Dim vInputs, vResults()
Dim c As Integer, i As Integer
'create INPUTS
c = Range("b5").End(xlToRight).Column
vInputs = Range("b5", Cells(9, c))
'determine last value in the column
c = UBound(vInputs, 2)
'create RESULTS
ReDim vResults(1 To 3, 1 To c)
For i = 1 To c
If vInputs(1, i) > 22 Then
'set values
Range("j16") = vInputs(1, i)
Range("n12") = vInputs(3, i)
Range("r14") = vInputs(5, i)
'copy output values into RESULTS
vResults(1, i) = Range("h41")
vResults(2, i) = Range("k41")
vResults(3, i) = Range("z14")
Do Until vResults(1, i) > 21
vInputs(5, i).Value = vInputs(5, i).Value + 1
Loop
End If
Next i
Range("c47").Resize(3, c) = vResults
Application.ScreenUpdating = True
End Sub