Unformatted text preview: is executed. But after “next” i=11, bigger than 10, so the loop stops. What happens if I need the counter i runs from 1 to 3, 5, … 9. That is, I want i increases by 2 each time. You can add a step size in the “for” line: for i=1 to 10 step 2 line1 next In this case, i will start from 1, which is smaller than 10, so line1 will be executed. After “next”, i will be increased by 2 to 3, still smaller than 10, so line1 will be executed again. After five iterations, i will jump from 9 to 11, bigger than 10, so the loop stops. Exercises: Ex1: Write some VBA codes to calculate 1+2+3+4+5…+10. Save your result in cell A1 in sheet2....
View Full Document
This note was uploaded on 05/17/2011 for the course ECO 220 taught by Professor Tanaka during the Spring '11 term at University of Toronto.
- Spring '11