Microsoft Knowledge Base |
|
XL: Incorrect Error Message: "For Without Next" |
|
|
Last reviewed: September 13, 1996
Article ID: Q120800 |
|
The information in this article applies to:
SUMMARYIn Microsoft Excel for Windows versions 5.x and 7.0, you may receive the following error message
For Without Nexteven when you do have the Next statement that concludes a For loop.
MORE INFORMATIONThe "For Without Next" error message is generated if Visual Basic, Applications Edition, detects that a For loop has been started but the Next statement is not present to end the loop. It is also generated erroneously if you have an End If statement within the For-Next loop.
Steps to Reproduce ProblemEnter the following on a module sheet:
Sub Test()
For X = 1 To 2
End If
Next
End Sub
If you try to run this code, you get the following error message:
For without NextThe proper error message should be:
End If without Block If REFERENCES"Visual Basic User's Guide," pages 139-140, 145-146
|
|
KBCategory: kbother
©1997 Microsoft Corporation. All rights reserved. Legal Notices. |