How you test depends on the Property's DataType:

| Type                                 | Test                            | Test2
| Numeric (Long, Integer, Double etc.) | If obj.Property = 0 Then        | 
| Boolen (True/False)                  | If Not obj.Property Then        | If obj.Property = False Then
| Object                               | If obj.Property Is Nothing Then |
| String                               | If obj.Property = "" Then       | If LenB(obj.Property) = 0 Then
| Variant                              | If obj.Property = Empty Then    |

You can tell the DataType by pressing F2 to launch the Object Browser and looking up the Object. Another way would be to just use the TypeName function:MsgBox TypeName(obj.Property)

Answer from Oorang on Stack Overflow
🌐
DEV Community
dev.to › trpricesoftware › vba-how-to-if-else-and-checking-for-empty-strings-1oh8
VBA How-To: If/Else and Checking For Empty Strings - DEV Community
July 1, 2020 - After writing this I ran this fully expecting to have a message box pop up saying that the variable is empty. However it did NOT pop up. However, when I debugged the code to make sure that the message box was really being skipped, I noticed that the variable showed that it had the value “”. Now, to me, this looks like an empty string but I decided to write another conditional testing the value of the string against “”: Sub CheckVarForEmpty() Dim stringVar As String If stringVar = "" Then MsgBox "Varable Is = to Empty String" End If End Sub
🌐
Microsoft Learn
learn.microsoft.com › en-us › office › vba › language › reference › user-interface-help › isempty-function
IsEmpty function (Visual Basic for Applications) | Microsoft Learn
False is always returned if expression contains more than one variable. IsEmpty only returns meaningful information for variants. This example uses the IsEmpty function to determine whether a variable has been initialized. Dim MyVar, MyCheck MyCheck = IsEmpty(MyVar) ' Returns True. MyVar = Null ' Assign Null. MyCheck = IsEmpty(MyVar) ' Returns False. MyVar = Empty ' Assign Empty. MyCheck = IsEmpty(MyVar) ' Returns True. ... Have questions or feedback about Office VBA or this documentation?
🌐
DokuWiki
nolongerset.com › empty-in-vba
Working with Empty in VBA
September 7, 2023 - The proper way to check whether a variable is nothing in VBA is via the IsEmpty() function. Returns a Boolean value indicating whether a variable has been initialized. You should never use the equal sign with the Empty keyword to check if a ...
🌐
TechOnTheNet
techonthenet.com › excel › formulas › isempty.php
MS Excel: How to use the ISEMPTY Function (VBA)
In VBA, you must use the ISEMPTY function. Here is an example of how to test whether a worksheet cell is empty using the ISEMPTY function: Sub TestCellA1() 'Test if the value is cell A1 is blank/empty If IsEmpty(Range("A1").Value) = True Then MsgBox "Cell A1 is empty" End If End Sub
🌐
Better Solutions
bettersolutions.com › vba › data-types › variant-empty.htm
VBA Data Types - Empty - Empty
Dim vMyVariant As Variant vMyVariant = "sometext" vMyVariant = Empty ... If you assign a variable to vbEmpty then you are actually just assigning the numerical value zero. Dim vMyVariant As Variant vMyVariant = "some text" vMyVariant = VBA.vbVarType.vbEmpty If (IsEmpty(vMyVariant) = True) Then 'This is False because the myVariant variable has been assigned the value 0.
🌐
Taylorbuiltsolutions
blog.taylorbuiltsolutions.com › home › vba how-to: if/else and checking for empty strings
VBA How-To: If/Else and Checking For Empty Strings - Taylor Built Solutions
June 30, 2020 - After writing this I ran this fully expecting to have a message box pop up saying that the variable is empty. However it did NOT pop up. However, when I debugged the code to make sure that the message box was really being skipped, I noticed that the variable showed that it had the value “”. Now, to me, this looks like an empty string but I decided to write another conditional testing the value of the string against “”: Sub CheckVarForEmpty() Dim stringVar As String If stringVar = "" Then MsgBox "Varable Is = to Empty String" End If End Sub
🌐
Excelanytime
excelanytime.com › excel › index.php
Excel VBA - Empty, ZLS, Null, Nothing, Missing
Sub EmptyNullVar() 'evaluate Empty / Null variable, use IsNull & VarType vba functions.
🌐
Rene Nyffenegger
renenyffenegger.ch › notes › development › languages › VBA › language › null-and-nothing-etc
VBA: null, nothing and more (or less)
option explicit sub testEmptyAndNull(var as variant) if isEmpty(var) then debug.print "| var is empty" end if if isNull(var) then debug.print "| var is null" end if debug.print "| var = " & var debug.print "" end sub sub main() dim dbl as double dim var as variant ' dbl = null ' null can only be assigned to variants ' ' Otherwise, a Run-time error 94 is thrown: Invalid use of Null ' If a variant is null can be tested with isNull: testEmptyAndNull var ' ' | var is empty ' | var = var = null testEmptyAndNull var ' ' | var is null ' | var = var = 42 testEmptyAndNull var ' ' | var = 42 end sub · Github repository about-VBA, path: /language/null-and-nothing/null.bas · Compare with the .NET class System.DBNull and the SQL null value. To determine if a variable is null, the function isNull(…) is used: if isNull(v) t hen …
Find elsewhere
🌐
Wall Street Mojo
wallstreetmojo.com › home › all blogs › vba resources › vba isempty
VBA IsEmpty | How to Use VBA IsEmpty Function? (Examples)
December 23, 2024 - Since it is a logical function, it will return the results in Boolean values, i.e., TRUE or FALSE. If the selected cell is empty, it will return TRUE, or else it will return FALSE.
🌐
Experts Exchange
experts-exchange.com › questions › 27270591 › VBA-Check-if-variant-is-empty.html
Solved: VBA Check if variant is empty | Experts Exchange
August 23, 2011 - Sub Macro2() ' Dim v() As Variant Dim x As Long On Error Resume Next x = LBound(v) If Err.Number = 9 Then ' subscript out of range error MsgBox "Array was empty" Else '...do something else End If On Error GoTo 0 End Sub ... hi, sorry my question wasnt clear enough, yes, i want to check if variant is initialized, i read data from recordset to variant by vVariant = .getrows to check if above array was empty or not initialized rather, i am check with code, similar to above posted one, however i want to avoid on error resume next, or error handlers, is there any other way to do this ?
🌐
Analysistabs
analysistabs.com › home › vba › vba functions › vba isempty function
VBA IsEmpty Function - Explained with Examples
September 30, 2023 - The VBA IsEmpty() function is used to check whether a variable or a field in an Excel spreadsheet is empty or not. It returns a Boolean value True if the variable or field is empty, and False if it is not empty.
🌐
MrExcel
mrexcel.com › forums › question forums › excel questions
Determine In Vba If Range Is Empty | MrExcel Message Board
August 20, 2011 - Into this register, VBA finds the todays month "Sheet" (ex: August) and puts the data from the report to the last empty cell. But when i select in between rows (like range A10:N10 & A12:N12), well the problem comes here.. excel bypasses Range A12 to N12 (from the example) and puts it to A13:N13 I hope i explained with a sense now. It's a bit comlicated i know but if i could show you it would be much easier. ... If Not (IsEmpty((Range("A:N")))) Then ActiveCell.Offset(0, 1).EntireRow.Range("B1").Select But thanks anyway for trying.
🌐
Microsoft Support
support.microsoft.com › en-us › office › isempty-function-a86d5871-f6bd-455c-9256-a69a42e55e50
IsEmpty Function - Microsoft Support
IsEmpty returns True if the variable is uninitialized, or is explicitly set to Empty; otherwise, it returns False. False is always returned if expression contains more than one variable. IsEmpty only returns meaningful information for variants. Note: Examples that follow demonstrate the use ...
🌐
Wellsr
wellsr.com › vba › 2016 › excel › use-isempty-vba-to-check-if-cell-is-blank
Use IsEmpty VBA to Check if Cell is Blank - wellsr.com
June 16, 2016 - You can prove the default value is an empty string by right clicking str1 and clicking “Add Watch.” By stepping into your macro (pressing the F8 button once), you can see see the default value is · "". Keep running your macro, and you’ll see all three MsgBoxes return False. VBA is a funny thing, like that. Although it can be used to check whether or not variables have been initialized, the most common use of IsEmpty is to check for blank cells.
🌐
Wall Street Mojo
wallstreetmojo.com › home › all blogs › vba resources › vba isnull
VBA ISNULL Function | How to Use VBA ISNULL() to Find Null values?
December 23, 2024 - : " & Result, vbInformation, "VBA ISNULL Function Example" End Sub · Even this code will return the result as FALSE because the supplied expression value “47895” isn’t the NULL value.
🌐
Codky
codky.com › home › english › vba › how to use isempty function in vba?
How to use IsEmpty function in VBA? - Codky
November 25, 2024 - Sub CheckIfEmpty() Dim MyVar As Variant ' MyVar is not initialized, so it is Empty If IsEmpty(MyVar) Then MsgBox "The variable is empty" Else MsgBox "The variable is not empty" End If ' Now we assign a value to MyVar MyVar = 10 ' MyVar is no longer Empty If IsEmpty(MyVar) Then MsgBox "The variable is empty" Else MsgBox "The variable is not empty" End If End Sub