### Isempty function in VBA

In this article, you will learn how to use the **IsEmpty** function in VBA to check if a cell is empty. If you want to do the same in Excel, a similar function is the **IsBlank** function. In this step-by-step tutorial, for all levels of Excel and VBA users, you will see how to use both functions.

## Using the IsEmpty function in VBA

As we already mentioned in the introduction, the **IsEmpty** is the simple function in VBA which checks if a cell is empty. If the selected does not contain any value, the function will return Boolean TRUE. On the other side, if the cell contains a value, the function returns FALSE. Here is the code:

1 2 3 4 5 6 7 8 9 |
If IsEmpty(Sheet1.Range("A1").Value) = True Then Sheet1.Range("B1").Value = "The cell A1 is empty" Else Sheet1.Range("B1").Value = "The value in A1 is " & Sheet1.Range("A1").Value End If |

In the example, we want to check if the cell A1 in the Sheet1 contains any value. Therefore, if the cell is empty, we will return “The cell A1 is empty” in the cell B1. If the cell contains a value, we will return the value of the cell A1 in the cell B1. Let’s run the code first with empty A1 and then with A1 containing some value:

*Image 1. Using the IsEmpty in VBA with the empty cell*

*Image 2. Using the IsEmpty in VBA with populated cell*

## Using the IsBlank function in Excel

The **IsBlank** function also checks if the value of the cell is blank, but this function does not exist in VBA. We’ll see on similar examples how to check if the cell is blank in Excel, using this formula:

1 |
=ISBLANK(A1) |

*Image 3. Using the IsBlank in Excel with blank A1 cell*

*Image 4. Using the IsBlank in Excel with populated A1 cell*

As you can see, we check if the cell A1 is blank and return the result of the function in the cell B1. In Image 3, the result of the function is Boolean TRUE. On the other side, in Image 4, the result of the function is FALSE, as the cell A1 is “11” and is not blank.

**Was this helpful?**

*You might like these related Code Examples...*