tags:

views:

40

answers:

2

is there a way to say in vba something like

from x = 1 to 100, by 10

so that the x's are 1, 10, 20, 30, etc. to 100?

+6  A: 

You can use STEP:

for x = 0 to 100 step 10

next x

This will take you through 0, 10, 20... 100

Since you want to start at 1 and go 1, 10, 20... 100, here is a slight modification

for x = 0 to 100 step 10
    if x = 0 then 
        y = 1 
    else
        y = x
    end if

    '// use y in all calculations downstream instead of x

next x
Raj More
A: 
For y = 0 To 10
    If y = 0 Then x = 1 Else x = 10 * y

    ' do stuff with x

Next y
Jay