If sngRow.Cells(1,23) = "ready for pickup" then..
我想要的是:
If sngRow.Cells(1,23) = "ready for pickup" and sngRow.Cells(1,22) is NOT EMPTY then..
我不知道如何在VBA中写它,似乎找不到一个简单的解决方案
有几种检查方法。我推荐IsEmpty()
功能
Sub test1()
Debug.Print Not IsEmpty(sngRow.Cells(1, 22))
Debug.Print VarType(sngRow.Cells(1, 22)) <> vbEmpty
Debug.Print sngRow.Cells(1, 22) <> "" ' If there is an error in the cell (e.g. division by 0), a type mismatch error occurs
Debug.Print sngRow.Cells(1, 22) <> vbNullString ' If there is an error in the cell (e.g. division by 0), a type mismatch error occurs
Debug.Print TypeName(sngRow.Cells(1, 22).Value) <> "Empty"
End Sub