excel vba代码如何跳出本次循环,执行x+1的下一次循环
DoUntil.Cells(x,8)=""If.Cells(x,7)<>""Then摘要=.Cells(x,7)EndIfpzkmkz=1:Sheets("凭证管理")....
Do Until .Cells(x, 8) = ""
If .Cells(x, 7) <> "" Then
摘要 = .Cells(x, 7)
End If
pzkmkz = 1: Sheets("凭证管理").Cells(y, 2) = 摘要
pzkmkz = 1: Sheets("凭证管理").Cells(y, 4) = .Cells(x, 8)
pzkmkz = 1: Sheets("凭证管理").Cells(y, 10) = .Cells(x, 9)
pzkmkz = 1: Sheets("凭证管理").Cells(y, 12) = .Cells(x, 11)
pzkmkz = 1: Sheets("凭证管理").Cells(y, 13) = .Cells(x, 12)
x = x + 1: y = y + 1
Loop
这个循环,我想要判断 .Cells(x, 11) + .Cells(x, 12) = 0 的话,直接 x= x+1,重新执行这个循环体,要在哪里添加什么语句? 展开
If .Cells(x, 7) <> "" Then
摘要 = .Cells(x, 7)
End If
pzkmkz = 1: Sheets("凭证管理").Cells(y, 2) = 摘要
pzkmkz = 1: Sheets("凭证管理").Cells(y, 4) = .Cells(x, 8)
pzkmkz = 1: Sheets("凭证管理").Cells(y, 10) = .Cells(x, 9)
pzkmkz = 1: Sheets("凭证管理").Cells(y, 12) = .Cells(x, 11)
pzkmkz = 1: Sheets("凭证管理").Cells(y, 13) = .Cells(x, 12)
x = x + 1: y = y + 1
Loop
这个循环,我想要判断 .Cells(x, 11) + .Cells(x, 12) = 0 的话,直接 x= x+1,重新执行这个循环体,要在哪里添加什么语句? 展开
1个回答
展开全部
Do Until .Cells(x, 8) = ""
IF .Cells(x, 11) + .Cells(x, 12) <> 0 THEN '这里。。。
If .Cells(x, 7) <> "" Then
摘要 = .Cells(x, 7)
End If
pzkmkz = 1: Sheets("凭证管理").Cells(y, 2) = 摘要
pzkmkz = 1: Sheets("凭证管理").Cells(y, 4) = .Cells(x, 8)
pzkmkz = 1: Sheets("凭证管理").Cells(y, 10) = .Cells(x, 9)
pzkmkz = 1: Sheets("凭证管理").Cells(y, 12) = .Cells(x, 11)
pzkmkz = 1: Sheets("凭证管理").Cells(y, 13) = .Cells(x, 12)
END IF '还有这里。。。
x = x + 1: y = y + 1
Loop
加个判断就好了啊。
更多追问追答
追问
不行,运行有错误,
追答
具体有什么误?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询