Columnwidth of a merged cell

  • Thread starter Thread starter Jos Vens
  • Start date Start date
J

Jos Vens

Hi,

does anyone know how I can determin the columnwidth of a merged cell.

There is a problem: I don't know if the cell is merged by the user and how
many cells are merged but I do know which cell is the possibly first cell of
the merge.

eg. I know cell [D5] is the first cell, so that columnwidth is certainly a
part of the total width. It is now possible (not certain) that the user
merges [E5:G5] with cell [D5]. When I check the width of [D5], I only get
the width of [D5], not the width of [D5:G5]

If [D5] is not merged with other cells, I only want the width of [D5], if it
is merged with [E5:Q5], I want the total width of [D5:Q5]

There is, afaik, no command like .merged which tells me if a cell is
included in a merged cell.

Thanks for your reply!

Jos Vens
 
Jos,

Try using

Range("D5").MergeArea.Width

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thanks Bob,

this is exactly what I was looking for!

Jos

Bob Phillips said:
Jos,

Try using

Range("D5").MergeArea.Width

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Jos Vens said:
Hi,

does anyone know how I can determin the columnwidth of a merged cell.

There is a problem: I don't know if the cell is merged by the user and how
many cells are merged but I do know which cell is the possibly first
cell
of
the merge.

eg. I know cell [D5] is the first cell, so that columnwidth is certainly a
part of the total width. It is now possible (not certain) that the user
merges [E5:G5] with cell [D5]. When I check the width of [D5], I only get
the width of [D5], not the width of [D5:G5]

If [D5] is not merged with other cells, I only want the width of [D5],
if
it
is merged with [E5:Q5], I want the total width of [D5:Q5]

There is, afaik, no command like .merged which tells me if a cell is
included in a merged cell.

Thanks for your reply!

Jos Vens
 
Back
Top