How do I express "if value is not empty" in the VBA language?

excel34 picture excel34 · Dec 31, 2009 · Viewed 575.7k times · Source

How do I express the condition "if value is not empty" in the VBA language? Is it something like this?

"if value is not empty then..."
Edit/Delete Message

Answer

Jon Crowell picture Jon Crowell · May 20, 2012

Use Not IsEmpty().

For example:

Sub DoStuffIfNotEmpty()
    If Not IsEmpty(ActiveCell.Value) Then
        MsgBox "I'm not empty!"
    End If
End Sub