Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel 2007 Autofit
I am using Excel 2007. Im working on a spreadsheet where I would like to
have a row (which has been merged and wrapped) height adjust automatically as the writing wraps around. Ive gone to the Home Tab, to the Cell Block, to Format, to Autofit Row Height, and it doesnt work. Ive tried clicking twice on the line item line to get it to automatically enlarge row, but that didnt work either. Any suggestions? Thanks Sharon |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel 2007 Autofit
IIRC, it does the same thing in 2003.
Barb Reinhardt "SJHMCSE" wrote: I am using Excel 2007. Im working on a spreadsheet where I would like to have a row (which has been merged and wrapped) height adjust automatically as the writing wraps around. Ive gone to the Home Tab, to the Cell Block, to Format, to Autofit Row Height, and it doesnt work. Ive tried clicking twice on the line item line to get it to automatically enlarge row, but that didnt work either. Any suggestions? Thanks Sharon |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel 2007 Autofit
Autofit does not work with merged cells. It the merged cell has only one
row you might find this macro helpful. ''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 "SJHMCSE" wrote in message ... I am using Excel 2007. I'm working on a spreadsheet where I would like to have a row (which has been merged and wrapped) height adjust automatically as the writing wraps around. I've gone to the Home Tab, to the Cell Block, to Format, to Autofit Row Height, and it doesn't work. I've tried clicking twice on the line item line to get it to automatically enlarge row, but that didn't work either. Any suggestions? Thanks Sharon |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel 2007 Autofit
Hi,
This is not a bug, this is how Microsoft intentionally coded it. As Jim pointed out you can't best fit wrapped cells. However, there is a caveat to that - if the cell is wider or taller than necessary and you apply best fit it will size the cell down. Why is it programmed this way? Suppose that you wrapped 20 lines of text which was 1200 characters long and then you double-clicked that column to do best fit, the column would become 1200 characters wide - actually the maximum column width is 255, but you get the idea. -- Thanks, Shane Devenshire "SJHMCSE" wrote: I am using Excel 2007. Im working on a spreadsheet where I would like to have a row (which has been merged and wrapped) height adjust automatically as the writing wraps around. Ive gone to the Home Tab, to the Cell Block, to Format, to Autofit Row Height, and it doesnt work. Ive tried clicking twice on the line item line to get it to automatically enlarge row, but that didnt work either. Any suggestions? Thanks Sharon |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel 2007 Autofit
I see. Thank you so much, especially for the explanation.
"ShaneDevenshire" wrote: Hi, This is not a bug, this is how Microsoft intentionally coded it. As Jim pointed out you can't best fit wrapped cells. However, there is a caveat to that - if the cell is wider or taller than necessary and you apply best fit it will size the cell down. Why is it programmed this way? Suppose that you wrapped 20 lines of text which was 1200 characters long and then you double-clicked that column to do best fit, the column would become 1200 characters wide - actually the maximum column width is 255, but you get the idea. -- Thanks, Shane Devenshire "SJHMCSE" wrote: I am using Excel 2007. Im working on a spreadsheet where I would like to have a row (which has been merged and wrapped) height adjust automatically as the writing wraps around. Ive gone to the Home Tab, to the Cell Block, to Format, to Autofit Row Height, and it doesnt work. Ive tried clicking twice on the line item line to get it to automatically enlarge row, but that didnt work either. Any suggestions? Thanks Sharon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 Autofit row/column height | Excel Discussion (Misc queries) | |||
Excel 2003 autofit ignored by some rows | Excel Discussion (Misc queries) | |||
### in print preview while using autofit in Excel 2007. | Excel Discussion (Misc queries) | |||
How do I modify the autofit function in Excel? | Excel Discussion (Misc queries) | |||
What's the shortcut key for autofit in MS Excel | Excel Discussion (Misc queries) |