![]() |
Autofit excelrow
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. |
Autofit excelrow
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. . |
Autofit excelrow
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. |
All times are GMT +1. The time now is 06:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com