Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How can I get a merged cell to auto adjust when I turn wrap text on?
-- Sony |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Excel will not autofit row heights for merged cells. If you need this
frequently you might run this macro: ''Simulates row height autofit for a merged cell if the active cell.. '' is merged. '' has Wrap Text set. '' includes only 1 row. ''Unlike real autosizing the macro only increases row height '' (if needed). It does not reduce row height (because another '' merged cell on the same row may needed a greater height '' than the active cell). Sub AutoFitMergedCellRowHeight() Dim CurrentRowHeight As Single, MergedCellRgWidth As Single Dim CurrCell As Range Dim ActiveCellWidth As Single, PossNewRowHeight As Single If ActiveCell.MergeCells Then With ActiveCell.MergeArea If .Rows.Count = 1 And .Cells(1).WrapText = True Then Application.ScreenUpdating = False CurrentRowHeight = .RowHeight ActiveCellWidth = ActiveCell.ColumnWidth For Each CurrCell In Selection MergedCellRgWidth = CurrCell.ColumnWidth + MergedCellRgWidth Next .MergeCells = False .Cells(1).ColumnWidth = MergedCellRgWidth .EntireRow.AutoFit PossNewRowHeight = .RowHeight .Cells(1).ColumnWidth = ActiveCellWidth .MergeCells = True .RowHeight = IIf(CurrentRowHeight PossNewRowHeight, _ CurrentRowHeight, PossNewRowHeight) End If End With End If End Sub -- Jim "Sony" wrote in message ... | How can I get a merged cell to auto adjust when I turn wrap text on? | -- | Sony |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Meged Cells and Wrap Text | Excel Discussion (Misc queries) | |||
how to see the whole text in merged cells? | New Users to Excel | |||
How can I Excel to re-size when wrapping text in merged cells | Excel Discussion (Misc queries) | |||
Auto fit wrapped and merged cells | Excel Discussion (Misc queries) | |||
How do I get merged cells to display all text. | Excel Discussion (Misc queries) |