Iterations In From Loop
is there a way to say in vba something like:
from x = 1 to 开发者_Python百科100, by 10
so that the x's are 1, 10, 20, 30, etc. to 100?
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
For y = 0 To 10
If y = 0 Then x = 1 Else x = 10 * y
' do stuff with x
Next y
精彩评论