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. |
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. |
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, |
All times are GMT +1. The time now is 01:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com