Innholdsfortegnelse
IsEmpty Description
Brukes til å se etter tomme celler eller ikke -initialiserte variabler.
Enkle IsEmpty -eksempler
1234 | Sub IsEmpty_Example ()Dim a Som variantMsgBox er tom (a)Slutt Sub |
Dette vil returnere True.
12345 | Sub IsEmpty_Example ()Dim a Som varianta = 10MsgBox er tom (a)Slutt Sub |
Dette vil returnere False.
IsEmpty Syntax
I VBA Editor kan du skrive "IsEmpty (" for å se syntaksen for IsEmpty -funksjonen:
IsEmpty -funksjonen inneholder et argument:
Uttrykk: Et uttrykk som vil bli evaluert.
Eksempler på Excel VBA IsEmpty Function
123 | Dim a Som varianta = NullMsgBox er tom (a) |
Resultat: Falske
123 | Dim a Som varianta = TomMsgBox er tom (a) |
Resultat: Sant
IsEmpty -funksjonen kan brukes til å kontrollere tomme celler.
1234567 | Sub IsEmpty_Example1 ()Dim cell As RangeFor hver celle i område ("A2: A5")cell.Offset (0, 1) = IsEmpty (celle)Neste celleSlutt Sub |
Resultatet er som følger.