Merged Cells in Worksheet, Test for

E

EagleOne

XL 2003

Simple way to test for existence of any merged cells in worksheet.

Must it be a cell by cell evaluation OR [Each myCell in myRange]
is there a "merged state" that is reflected on a Sheet basis?
[ i.e. like Activesheet.UsedRange.MergeCells]

EagleOne
 
E

EagleOne

Re: Merged Cells in Worksheet, Test for

Ultimately I found a way to determine, on a Sheet-level basis if there
are merged cells on the sheet somewhere (without having to examine each
cell in the used range). This is important, because it saves time on
very large worksheets.

NOTE: this works in XL 2003, not sure for older versions.

Sub SheetLevelTestForMergedCells()

If Cells.MergeCells = False Then
MsgBox "No Merged Cells on this Sheet!"
Else
MsgBox "Merged Cells Found!"
End If

End Sub

For some reason, neither

Cells.MergeCells = True

nor

Cells.MergeCells = Null

works in the reverse. BTW, if someone finds inconsistencies please
post back.
 
Top