ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Merged Cells in Worksheet, Test for (https://www.excelbanter.com/excel-discussion-misc-queries/111888-merged-cells-worksheet-test.html)

[email protected]

Merged Cells in Worksheet, Test for
 
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

Carlo

Merged Cells in Worksheet, Test for
 
Hi EagleOne

search in the VBA-Help for MergeCells

Hth Carlo

" wrote:

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


EagleOne

Merged Cells in Worksheet, Test for
 
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.



wrote:
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




All times are GMT +1. The time now is 04:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com