for statements

 

 

VBA Code Protection > Supported VBA syntax by compiler > for statements

 

Syntax:

 

FOR counter = initialValue TO  finalValue STEP stepValue

Statements

NEXT

 

For statement set counter to initialValue, repeats execution of statement until "next" and increment value of counter by stepValue, until counter reachs finalValue.

Step part is optional, and if omitted stepValue is considered 1.

 

Examples:

SCRIPT 1:

 

FOR c = 1 TO 10 STEP 2 

 a = a + c

NEXT

 

SCRIPT 2:

 

FOR I = a TO b

 j = i ^ 2

sum = sum + j

NEXT

 

select case statements

 


Copyright © 2023 G.D.G. Software