this function returns a true or false depending on the number of visible rows

Function visLines(ByRef rng As Range) As Boolean
Application.Volatile
Dim rng1 As Range
Dim rng2 As Range
Dim bln As Boolean

Set rng1 = rng.Resize(rng.Row).Offset(1 - 1 * rng.Row)

For Each rng2 In rng1
If rng2.Height <> 0 Then
bln = Not bln
End If
Next
Debug.Print rng1.Address, l, bln
visLines = bln
End Function


then use conditional formatting using the cell reference so if in cell D5 use vilines(D5)

cheers