ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Merged Cells: Any way to backtrack? (https://www.excelbanter.com/excel-programming/385109-merged-cells-any-way-backtrack.html)

(PeteCresswell)

Merged Cells: Any way to backtrack?
 
If somebody sends me a worksheet that contains merged cells, Is there any way
for me to programmatically determine what the original component cells were?
--
PeteCresswell

Chip Pearson

Merged Cells: Any way to backtrack?
 
Pete,

You could try something like the following:

Sub AAA()
Dim MergeCell As Range
Dim OrigCells As Range
Set MergeCell = Range("A3")
With MergeCell.MergeArea
Set OrigCells = .Resize(.Rows.Count, .Columns.Count)
End With
Debug.Print OrigCells.Address
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email on the web site)

"(PeteCresswell)" wrote in message
...
If somebody sends me a worksheet that contains merged cells, Is there any
way
for me to programmatically determine what the original component cells
were?
--
PeteCresswell



(PeteCresswell)

Merged Cells: Any way to backtrack?
 
Per Chip Pearson:
You could try something like the following:


Bingo!

Thanks.
--
PeteCresswell

Tom Ogilvy

Merged Cells: Any way to backtrack?
 
Chip,

Why not just

Sub AAA()
Debug.print Range("A3").MergeArea.Address
End Sub

Just curious.

--
Regards,
Tom Ogilvy


"Chip Pearson" wrote in message
...
Pete,

You could try something like the following:

Sub AAA()
Dim MergeCell As Range
Dim OrigCells As Range
Set MergeCell = Range("A3")
With MergeCell.MergeArea
Set OrigCells = .Resize(.Rows.Count, .Columns.Count)
End With
Debug.Print OrigCells.Address
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email on the web site)

"(PeteCresswell)" wrote in message
...
If somebody sends me a worksheet that contains merged cells, Is there any
way
for me to programmatically determine what the original component cells
were?
--
PeteCresswell





Chip Pearson

Merged Cells: Any way to backtrack?
 
Why not just

Sub AAA()
Debug.print Range("A3").MergeArea.Address
End Sub


Absolutely no reason whatsoever. That is definitely a better option.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email on the web site)

"Tom Ogilvy" wrote in message
...
Chip,

Why not just

Sub AAA()
Debug.print Range("A3").MergeArea.Address
End Sub

Just curious.

--
Regards,
Tom Ogilvy


"Chip Pearson" wrote in message
...
Pete,

You could try something like the following:

Sub AAA()
Dim MergeCell As Range
Dim OrigCells As Range
Set MergeCell = Range("A3")
With MergeCell.MergeArea
Set OrigCells = .Resize(.Rows.Count, .Columns.Count)
End With
Debug.Print OrigCells.Address
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email on the web site)

"(PeteCresswell)" wrote in message
...
If somebody sends me a worksheet that contains merged cells, Is there
any way
for me to programmatically determine what the original component cells
were?
--
PeteCresswell







All times are GMT +1. The time now is 04:22 PM.

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