Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
WrapText Property
Excel's Help states:
"Microsoft Excel will change the row height of the range, if necessary, to accommodate the text in the range." Using the following, the row height does not change: With rng .MergeCells = True .Value = str ' Some long string that should have to wrap .WrapText = True End With Does not matter whether Value is set before/after WrapText. Am I doing something wrong? -- http://www.standards.com/; See Howard Kaikow's web site. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
WrapText Property
Text in merged cells does not make the row height autosize/fit, even with
WrapText. How best to fix will depend on how much you know about 'required' heights of other cells in the row. In the simplest scenario start by setting the row's height to default, and some/all of this ' trap original height rng(1).MergeArea.MergeCells = False rng.HorizontalAlignment = xlCenterAcrossSelection rng(1).value = sLongText rng.WrapText = True ' might need to autofit the row here Ht = rng(1).Height if origHeight Ht then Ht = origHeight rng.HorizontalAlignment = xlLeft rng(1).EntireRow.RowHeight = Ht ' if mergearea is only one row Of course simply doing the above might mess up larger heights in other merged cells, so how much you'll need to check will depend on what you've got. From memory a macro by Jim Rech is often recommended to autofit merged cells (search this group) Regards, Peter T "Howard Kaikow" wrote in message ... Excel's Help states: "Microsoft Excel will change the row height of the range, if necessary, to accommodate the text in the range." Using the following, the row height does not change: With rng .MergeCells = True .Value = str ' Some long string that should have to wrap .WrapText = True End With Does not matter whether Value is set before/after WrapText. Am I doing something wrong? -- http://www.standards.com/; See Howard Kaikow's web site. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
WrapText Property
"Bob Phillips" wrote in message
... Is the range more than one cell? That could be the problem. Help states that the property applies to a RangeCollection, which is: "Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3-D range." I have tried both Select and Activate on the range, still no height adjustment, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
WrapText Property | Excel Programming | |||
Remove WrapText | Excel Programming | |||
wraptext is not updating when using references to another cell | Excel Programming | |||
Convert from WrapText | Excel Programming | |||
Convert from WrapText | Excel Programming |