Home > Articles > Home & Office Computing > Microsoft Applications

This chapter is from the book

Using the IsEmpty Function to Check Whether a Cell Is Empty

The IsEmpty function returns a Boolean value that indicates whether a single cell is empty: True if empty, False if not. The cell must truly be empty for the function to return True. If it contains even just a space that you cannot see, Excel does not consider the cell to be empty:


Say that you have several groups of data separated by a blank row. You want to make the separations a little more obvious. The following code goes down the data in column A. When it finds an empty cell in column A, it colors in the first four cells of that row (see Figure 3.4):

LastRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To LastRow
    If IsEmpty(Cells(i, 1)) Then
        Cells(i, 1).Resize(1, 4).Interior.ColorIndex = 1
    End If
Next i
Figure 3.4

Figure 3.4 Colored rows separating data.

  • + Share This
  • 🔖 Save To Your Account