Selected Answer
Mark
(I've replaced my earlier answer with a VBA solution, given you receive the log file as per your example).
The revised file has a sub called MergeIfNoL in Module1. The code will run on the active worksheet of this file so you can pick a sheet and run it from VB Explorer. Or you might assign a key combination to it.
I've used two nested loops, one going down rows and the other going along columns (but in steps of two, to check pairs of values).
Per pair of cells, I've got an If statement (split over lines just for clarity) which tests if there's any text in them and they don't have the "non-work" shading (defined by the number for the cell's .Interior.Color). It only merges them if all four tests are met. It then moves on through the loops.
The code is commented so you can (hopefully) follow what is happening:
Option Explicit
Sub MergeIfNoL()
Dim StRw As Long, LstRw As Long
Dim StCol As Long, EndCol As Long
Dim Shd As Long, Rw As Long, Col As Long 'declare variable for shading and counters
StRw = 3 'set start row
LstRw = Range("A" & Rows.Count).End(xlUp).Row - 1 'determine last row before totals
StCol = 5 'set start column, E=5
EndCol = 40 'set last column, AN=40
Shd = 13882323 'set colour used for non-work shading
With ThisWorkbook.ActiveSheet
For Rw = StRw To LstRw 'loop down rows
For Col = StCol To EndCol - 1 Step 2 ' loop columns in pairs
With .Cells(Rw, Col) ' test four conditions are met before merge
If .Value = "" And .Interior.Color <> Shd _
And .Offset(0, 1).Value = "" _
And .Offset(0, 1).Interior.Color <> Shd Then
.Resize(1, 2).Merge 'merge if so
End If
End With
Next Col
Next Rw
End With
End Sub
Note that I tried the code on the three rightmost sheets in the file and it seemed to work fine (and very quickly!).
Hope this fixes your problem.