Hi,
how do I express the condition "if value is not empty " in VBA language ? Is it something like this ?
"if value is not empty then.." Edit/Delete Message
Hi,
how do I express the condition "if value is not empty " in VBA language ? Is it something like this ?
"if value is not empty then.." Edit/Delete Message
I am not sure if this is what you are looking for
if var<>"" then
dosomething
or
if isempty(thisworkbook.sheets("sheet1").range("a1").value)= false then
the ISEMPTY function can be used as well
It depends on what you want to test:
IF strName = vbNullString
or IF strName = ""
iF myObject is nothing
if isnull(myField)
if range("B3") = ""
Etc... Maybe your question should be more specific ?
Why not just use the built-in Format() function?
Dim vTest As Variant
vTest = Empty ' or vTest = null or vTest = ""
If Format(vTest) = vbNullString Then
doSomethingWhenEmpty()
Else
doSomethingElse()
End If
Format() will catch empty variants as well as null ones and transforms them in strings. I use it for things like null/empty validations and to check if an item has been selected in a combobox.