VBA/Excel/Access/Word/Data Type Functions/IsEmpty — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 15:47, 26 мая 2010
Test a Variant variable to see whether it has the Empty value
<source lang="vb">
Sub EmptyVar()
Dim vntName As Variant Debug.Print IsEmpty(vntName) "Prints True vntName = "" Debug.Print IsEmpty(vntName) "Prints False vntName = Empty Debug.Print IsEmpty(vntName) "Prints True
End Sub
</source>
Using the ISEMPTY Function to Check Whether a Cell Is Empty
<source lang="vb">
Sub isemptyDemo()
LastRow = cells(Rows.count, 1).End(xlUp).row For i = 1 To LastRow If isempty(cells(i, 1)) Then cells(i, 1).resize(1, 4).Interior.ColorIndex = 1 End If Next i
End Sub
</source>
Working with Empty and Null
<source lang="vb">
Sub StringVar()
Dim strName As String Debug.Print IsEmpty(strName) "Prints False Debug.Print strName = "" "Prints True
End Sub
</source>