Hello Everyone,

I have wrote a VBA code to check in a range cells are merged or not, but the code is not working please check once and correct me where is I am wrong.


Function ContainsMergedCells(rng As Range)
Dim cell As Range
For Each cell In rng
If cell.MergeCells Then
ContainsMergedCells = True
Exit Function
End If
Next cell
ContainsMergedCells = False
End Function


Thanks in advance