【发布时间】:2017-09-28 10:14:31
【问题描述】:
我知道这段代码可以很容易地重写为使用循环,但我不能。
k1 = (exk - 3 * increment)
k2 = k1 + 0.01
k3 = k2 + 0.01
k4 = k3 + 0.01
k5 = k4 + 0.01
k6 = k5 + 0.01
k7 = k6 + 0.01
Cells(7, 2).Value = k1
Cells(8, 2).Value = k2
Cells(9, 2).Value = k3
Cells(10, 2).Value = k4
Cells(11, 2).Value = k5
Cells(12, 2).Value = k6
Cells(13, 2).Value = k7
【问题讨论】:
-
for <variable> = <start> to <end> {step <increment>}for y=7 to 12:cells(y,2)=k1:k1=k1+0.01:next y