我怎样才能在cicle中使用标准

时间:2015-05-22 16:05:34

标签: excel vba loops excel-vba

我想在循环中使用一个标准 但没有工作

UR = 3
ReDim arng(UR, 3) As Variant
For X = 0 To UR
    arng(X, 0) = ConvDate(Cells(X , 8))
    arng(X, 1) = ConvDate(Cells(X , 12))
    arng(X, 2) = Iif(Cells(X , 12) = "", MsgBox("empty"), MsgBox("Full")) 
Next X

即使单元格(X,12)实际上是空的,两个消息都显示 为什么呢?!?!?

是不是可以使用标准? 感谢

1 个答案:

答案 0 :(得分:0)

工作了一点点,试试这个

dim UR as integer
UR = 3
ReDim arng(UR, 3) As Variant

For X = 0 To UR
arng(X, 0) = ConvDate(Cells(X , 8))
arng(X, 1) = ConvDate(Cells(X , 12))

if Cells(X , 12) = "" then
  MsgBox("empty")

else
  msgbox("full")

end if 

Next X