ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Columnwidth of a merged cell (https://www.excelbanter.com/excel-programming/281948-columnwidth-merged-cell.html)

Jos Vens

Columnwidth of a merged cell
 
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



Bob Phillips[_5_]

Columnwidth of a merged cell
 
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" wrote in message
...
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 Vens

Columnwidth of a merged cell
 
Thanks Bob,

this is exactly what I was looking for!

Jos

"Bob Phillips" schreef in bericht
...
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" wrote in message
...
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








All times are GMT +1. The time now is 01:14 PM.

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