VBA错误424与空
我试图寻找错误424的问题,但我没有find任何符合我的情况。
我在第三行收到了424错误:
For icount = 2 To no_items If hid.Cells(icount, 1).Value > 0 Then 'If hid.Cells(icount, 1).Offset(-1).Value Is Empty Then 'hid.Cells(icount, 1).Value = 1 'Else hid.Cells(icount, 1).Value = 1 + hid.Cells(icount, 1).Value 'End If End If Next
我的声明如下:
Dim hid As Worksheet Set hid = ThisWorkbook.Worksheets("Hidden") hid.Visible = True
之前,我在第2行有同样的错误:
If hid.Cells(icount, 1) is not empty Then
我不明白为什么会有错误,所有的事情都应该按照它的方式来定义。 你能帮我吗?
用于Not ISEmpty的语法不正确,您需要更改以下行:
If hid.Cells(icount, 1) is not empty Then
至:
If Not IsEmpty(hid.Cells(icount, 1)) Then