Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to use autofit on a row,
and at the same time use "merge cells" on that row? Or does anyone know how to show one or more rows of text in one mereged cell. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Sofia,
I hope I understood you right: You can show more than one row of text within one cell (if merged or not) by using Alt+Return.... Besides: has this something to do with VBA? Maybe you meant something else? Best Markus -----Original Message----- Is it possible to use autofit on a row, and at the same time use "merge cells" on that row? Or does anyone know how to show one or more rows of text in one mereged cell. . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can use autofit on a row with a merged cell but autofit only looks at
the unmerged cells. If you want to simulate autofit on a one row merged cell here's a macro that may help: ''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 .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 Rech Excel MVP "Sofia Helin" wrote in message m... | Is it possible to use autofit on a row, | and at the same time use "merge cells" on that row? | | Or does anyone know how to show one or more rows of text in one mereged cell. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Autofit | Excel Discussion (Misc queries) | |||
Autofit (Columns.EntireColumn.AutoFit) does not work | Excel Discussion (Misc queries) | |||
autofit does not autofit | Excel Discussion (Misc queries) | |||
Autofit | Excel Programming | |||
row autofit | Excel Programming |