既然两个FOR之间没有联系,为何不直接做两个循环呢FOR X=1 TO 20IF X>15 THEN EXIT FORNEXTFOR Y=1" />
乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > <em>Excel</em> <em>vb</em>a循环语句-exce

<em>Excel</em> <em>vb</em>a循环语句-exce

作者:乔山办公网日期:

返回目录:excel表格制作




既然两个FOR之间没有联系,为何不直接做两个循环呢
FOR X=1 TO 20
IF X>15 THEN EXIT FOR
NEXT
FOR Y=1 TO 20
IF Y>x THEN EXIT FOR
NEXT
Sub abc()
Dim i%
For i = 1 To 9999
If --Right(i, 1) = 1 Then
Range("d" & i).FormulaR1C1 = "=rc[-3]"
Else
Range("d" & i).FormulaR1C1 = "=r[-1]c"
End If
Next
End Sub

没看懂你的行列关系,我猜是不是这样
sub test()
for i=35 to 52
if range("A"&i)="new" o rrange("A"&i)="obs" or range("A"&i)="dal" then
range("l"&i).locked=true
range("k"&i).locked=true
elseif
range("A"&i)="add" o rrange("A"&i)="exp" or range("A"&i)="rev" then
range("c"&i).locked=true
range("h"&i).locked=true
end if
next
end sub

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网