ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Merged Cells Value (https://www.excelbanter.com/excel-programming/336581-merged-cells-value.html)

Gap

Merged Cells Value
 
Hello,

If A1:C1 are merged cells, why is the value of B1 & C2 null and only A1
has the value?

How to get the value set in the merged cells if I have a reference to
say B1 or C1 here?

Tks & Regds
Gap


Chip Pearson

Merged Cells Value
 
When dealing with merged cells (I avoid them at all costs; too
much trouble with cut/paste, sorting, etc), you reference the top
left cell in the merge area, and ignore the other cells.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Gap" wrote in message
oups.com...
Hello,

If A1:C1 are merged cells, why is the value of B1 & C2 null and
only A1
has the value?

How to get the value set in the merged cells if I have a
reference to
say B1 or C1 here?

Tks & Regds
Gap




Tom Ogilvy

Merged Cells Value
 
Because only A1 holds the value. But you can use:

set rng= Range("B1")
msgbox rng.mergearea(1).Value

--
Regards,
Tom Ogilvy




"Gap" wrote in message
oups.com...
Hello,

If A1:C1 are merged cells, why is the value of B1 & C2 null and only A1
has the value?

How to get the value set in the merged cells if I have a reference to
say B1 or C1 here?

Tks & Regds
Gap




Greg Wilson

Merged Cells Value
 
Tru:
MsgBox Range("B1").MergeArea(1, 1).Value

Regards,
Greg

"Gap" wrote:

Hello,

If A1:C1 are merged cells, why is the value of B1 & C2 null and only A1
has the value?

How to get the value set in the merged cells if I have a reference to
say B1 or C1 here?

Tks & Regds
Gap




All times are GMT +1. The time now is 10:00 AM.

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