Home > Articles

Referring to Ranges

This chapter is from the book

This chapter is from the book

Using the IsEmpty Function to Check Whether a Cell Is Empty

The IsEmpty function returns a Boolean value of whether a single cell is empty or not; True if empty, False if not. The cell must truly be empty. Even if it has a space in it, which you cannot see, Excel does not consider it empty:


Look at Figure 3.5. You have several groups of data separated by a blank row. You want to make the separations a little more obvious.

Figure 3.5Figure 3.5 Blank empty rows separating data.

The following code goes down the data in Column A and where it finds an empty cell, colors in the first four cells for that row (see Figure 3.6):

LastRow = Range("A65536").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.6Figure 3.6 Colored rows separating data.

  • + Share This
  • 🔖 Save To Your Account