1

Can someone explain how to add a variable within a Do Until Loop? I can't quite get mine to work. I am getting an error that says "Next without for". Here is what I have so far:

Application.ScreenUpdating = True

Dim i As Long
For i = 5 To 6

Do Until Sheets("Analysis").Range("L1") < 50 And Sheets("Analysis").Range("N1") < 250000 And Sheets("Analysis").Range("AB" & i) > 0.05


Next i


Application.Calculate

Loop

Thank you!

1

1 Answer 1

1

You are overlapping your loops - I put the Do loop inside the For loop below:

Dim i As Long
For i = 5 To 6

Do Until Sheets("Analysis").Range("L1") < 50 And Sheets("Analysis").Range("N1") < 250000 And Sheets("Analysis").Range("AB" & i) > 0.05
Application.Calculate

Loop
Next i
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.