Hello,
Need assistance please to fix a code below that is not functioning as desired. I have two incremental statements that build on each other and produce a result in cell H9. I would like to stop the iterations if a certain value is reached in cell H9.

I run the macro but only the statements perform. The If Then statement to stop the macro does not function when it reaches a defined value.

Could you help me to resolve if I have correctly structured the IF THEN statement based on the incremental results.

Thanks in advance.

Sub Iteration_Method()

If ActiveSheet.Range("H9").Value > 2 Then
Exit Sub

End If

Dim a As Integer

a = 1

For a = 1 To 3
ActiveSheet.Range("D8").Value = a

Dim c As Integer
c = 1

Do
ActiveSheet.Range("D10").Value = c
c = c + 1
Loop Until c > 1000

Next a

End Sub