View Single Post
  #3   Report Post  
DrKilbert
 
Posts: n/a
Default

Thanks Gord for getting back to me on this.

Let me explain in more detail. I have a worksheet that is setup as a grid,
and I merge varying cells to represent various units of differing sizes /
configurations. I have code that permits me to count the cells according to
their background color. But it does just that, it counts each cell; i.e. A1
and B1 belong to the same merged cell; A2 and B2 belong only to their own
cell. When I run the counting code, it counts A1 and B1 as if they were
individual cells and not the merged cell. So, in reality it does look at
each cell individually regardless of being merged. I know I'm probably
looking at this all wrong, except I know this is what is happening.
Basically, you can reference merged cells A1:B1 by either A1, or B1. This
being said, if there was a way of comparing cell A1 to cell B1 and know that
they belonged to the same group of merged cells, I'd be able to flexibly map
a preset grid according to however the cells may be merged and/or not merged
.. This may be the long solution...

The alternative may be something along the lines of:
(Though I'm struggling on the syntax)

For Each [merged cells] in [range]
...{counting process}...
End For

Having not gotten the code to function yet, my question with this method is;
since A2 and B2 are not merged cells, are they included or not when counting
merged cells elements?

Thanks again for your time and thoughts on this...

"Gord Dibben" wrote:

Adjacent cells cannot be merged cells.

If two or more cells are merged, they become one cell.

That is what "merge" means.

Perhaps there is another way to phrase the question?


Gord Dibben Excel MVP


On Fri, 25 Mar 2005 11:11:02 -0800, DrKilbert
wrote:

How do I compare two adjacent cells to determine if they belong to the same
merged cell?