Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

The 'For..Next' Statement

Posted on 2003-02-20
5
Medium Priority
?
147 Views
Last Modified: 2012-05-04
As far as I know,this is how the 'For..Next' statement works:
For i=1 to 5
.
.
Next i

What I want to do now is:
For i=5 to i=1

Next i

Of course this does not work, I want to do a down count from 5 to 1. Any suggestions on how to do that??
0
Comment
Question by:VivienW
5 Comments
 
LVL 13

Accepted Solution

by:
Glen A. earned 140 total points
ID: 7991532
for i = 5 to 1 step -1
.
.
next i
0
 
LVL 2

Expert Comment

by:mmcmillen
ID: 7991592
yep. that will do it
0
 
LVL 2

Expert Comment

by:Jacamar
ID: 7991737
another one is this

for i = 1 to 5
j = 6 - i




next i
0
 
LVL 9

Expert Comment

by:Naveen Swamy
ID: 7991873
AlbertaBeef is right
0
 

Expert Comment

by:cdhildebrandt
ID: 7991887
Answers above are correct.  Be careful with the "next i".  As you know it will add one to "i" when you want to count down.  If you use either of the codes directions above, this will not be an issue.  However, if you choose one of the many other solution to this question, it could be.

Carl
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question