Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default 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.
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofit Maxine Excel Discussion (Misc queries) 2 April 22nd 10 12:50 PM
Autofit (Columns.EntireColumn.AutoFit) does not work Michiel via OfficeKB.com Excel Discussion (Misc queries) 3 February 10th 09 05:29 PM
autofit does not autofit rreneerob Excel Discussion (Misc queries) 1 October 17th 05 05:55 PM
Autofit kevin Excel Programming 3 October 4th 04 09:26 PM
row autofit Robin Hammond Excel Programming 0 September 6th 03 02:33 AM


All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"