Office中国论坛/Access中国论坛

标题: 求教excel vba 中 WHILE 的用法问题 ,谢了 [打印本页]

作者: city0219    时间: 2006-11-2 01:07
标题: 求教excel vba 中 WHILE 的用法问题 ,谢了
Private Sub CommandButton1_Click()
Dim I As Integer
Dim B As String
I = 2
B = Sheets("22").Range("A1").Value

'If Sheets("11").Cells(I, 4).Value Like "*" & B & "*" Then Sheets("22").Cells(I, 1).Value = Sheets("11").Cells(I, 4).Value

While Sheets("11").Cells(I, 4).Value  '???
If InStr(Sheets("11").Cells(I, 4).Value, B) Then Sheets("22").Cells(I, 1).Value = Sheets("11").Cells(I, 4).Value
I = I + 1
Wend

End Sub

错在哪里啊??想不出来


作者: cola    时间: 2006-11-2 03:26
WHILE后面应该跟数值表达式或字符串表达式,其计算结果为 TrueFalse。如果为 Null,则 condition 会视为 False

这些问题可以自己动手查看帮助而得到解决的.
作者: ninar    时间: 2006-11-3 05:49
While Sheets("11").Cells(I, 4).Value <>""




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3