• Print
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:

`IsEmpty(Cell)`

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 Colored rows separating data.
{"ft_lang_label":"__label__en","ft_lang_prob":0.69327885,"math_prob":0.8475445,"size":1568,"snap":"2020-10-2020-16","text_gpt3_token_len":379,"char_repetition_ratio":0.15856777,"word_repetition_ratio":0.07168459,"special_character_ratio":0.22512755,"punctuation_ratio":0.0794702,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9548264,"pos_list":[0,1,2],"im_url_duplicate_count":[null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-02-16T19:14:02Z\",\"WARC-Record-ID\":\"<urn:uuid:bf2ba8af-e8aa-48bb-b8e3-260314fd820d>\",\"Content-Length\":\"45839\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:9a530566-201d-4007-af77-b054271101af>\",\"WARC-Concurrent-To\":\"<urn:uuid:457256a7-6013-4ce1-af9d-e30717854473>\",\"WARC-IP-Address\":\"159.182.165.92\",\"WARC-Target-URI\":\"http://www.informit.com/articles/article.aspx?p=2455213&seqNum=13\",\"WARC-Payload-Digest\":\"sha1:7WPW7DCQTB22CWQR7VVK6VICYVPR7AFO\",\"WARC-Block-Digest\":\"sha1:5DZV6VP2UVJ7UXB57BME7PTVGEYOOZMJ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-10/CC-MAIN-2020-10_segments_1581875141396.22_warc_CC-MAIN-20200216182139-20200216212139-00428.warc.gz\"}"}