ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Cells are Merged. How to know where to where??? (https://www.excelbanter.com/new-users-excel/117558-cells-merged-how-know-where-where.html)

musa.biralo

Cells are Merged. How to know where to where???
 
Hi,
i have a merged cells say (a1 to b5). Now i am trying to know,

1) whether the cell is merged or not
2) if merged, where to where, from which cell to which cell

Your help will highly be appreciated.

Huge Thanks

musa.biralo


Bob Phillips

Cells are Merged. How to know where to where???
 
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:B5")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Next collItem


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"musa.biralo" wrote in message
oups.com...
Hi,
i have a merged cells say (a1 to b5). Now i am trying to know,

1) whether the cell is merged or not
2) if merged, where to where, from which cell to which cell

Your help will highly be appreciated.

Huge Thanks

musa.biralo




musa.biralo

Cells are Merged. How to know where to where???
 
Hey Bob,

Thank so much...this is more than what i was expecting....Great Help.

Thanks again
musa.biralo


Bob Phillips wrote:
Dim cell As Range
Dim coll As Collection
Dim collItem


Set coll = New Collection
For Each cell In Range("A1:B5")
On Error Resume Next
If cell.MergeCells Then
coll.Add cell.MergeArea.Address(False, False), _
cell.MergeArea.Address(False, False)
End If
On Error GoTo 0
Next cell

For Each collItem In coll
MsgBox collItem
Next collItem


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"musa.biralo" wrote in message
oups.com...
Hi,
i have a merged cells say (a1 to b5). Now i am trying to know,

1) whether the cell is merged or not
2) if merged, where to where, from which cell to which cell

Your help will highly be appreciated.

Huge Thanks

musa.biralo




All times are GMT +1. The time now is 06:43 AM.

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