Solved Excel macro to highlight every row above every empty row

December 17, 2014 at 11:27:39
Specs: Windows 7
I have an excel data sheet which is divided into data blocks of variable number of rows. Data blocks are separated from each other with an empty row. What I am in a dire need for is a macro that highlights the last row of each data block; which is the row above the empty row.

Can someone help me with this request please?
Thanks in advance

See More: Excel macro to highlight every row above every empty row

Report •

December 17, 2014 at 20:56:59
✔ Best Answer
You can use Conditional Formatting to accomplish your goal.

Let's say your data blocks are in A1:F100.

Select the entire range and then choose Conditional Formatting from the Home ribbon.
Next choose New Rule and then "Use a formula to determine which cells to format."

If there are no blanks cells within your data blocks, enter this formula, and then choose a fill color.


Any cell that has an empty cell below it will be highlighted. Therefore, as long as there are no empty cells within the "body" of the data block, only the bottom row of cells in each block will be highlighted.

If there will be empty cells within the data block, then this should work:


Any row in columns A:F that has 6 empty cells below it will be highlighted.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

message edited by DerbyDad03

Report •
Related Solutions

Ask Question