ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find range of merged cells (https://www.excelbanter.com/excel-programming/382370-find-range-merged-cells.html)

mcphc

Find range of merged cells
 
I would like a macro that can search one cell say "A1" and check if the cell
is merged.

If the cell is merged then return all cells merged with "A1"

Thanks

NickHK

Find range of merged cells
 
Something like this:

Public Function MergedCells(WhichRange As Range) As Variant

With WhichRange
If .MergeCells = False Then
MergedCells = False
Else
MergedCells = .MergeArea.Address
End If
End With

End Function

NickHK

"mcphc" wrote in message
...
I would like a macro that can search one cell say "A1" and check if the

cell
is merged.

If the cell is merged then return all cells merged with "A1"

Thanks




mcphc

Find range of merged cells
 
Cheers Nick just what I was looking for

"NickHK" wrote:

Something like this:

Public Function MergedCells(WhichRange As Range) As Variant

With WhichRange
If .MergeCells = False Then
MergedCells = False
Else
MergedCells = .MergeArea.Address
End If
End With

End Function

NickHK

"mcphc" wrote in message
...
I would like a macro that can search one cell say "A1" and check if the

cell
is merged.

If the cell is merged then return all cells merged with "A1"

Thanks






All times are GMT +1. The time now is 02:01 AM.

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