Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm working in Excel 2002.
My spreadsheet consists of columns A - AH, 22 rows. The last row, 22, is merged to one cell, the lenght of A- AH. I would like the row to expand based on the amount of text that is inputted into it. I have tried the following coding but it doesn't seem to work. 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 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 I have placed the above coding in Module2. The document is also protected allowing the user access to input areas only. I don't know why it's not working. Any help would be appreciated. Thanks! -- Jamie |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Auto Row Height with Wrapped Text in Merged Cells Problem | Excel Discussion (Misc queries) | |||
How to enable auto height with merged cells? | Excel Worksheet Functions | |||
Auto Row Height in Merged Cells with pre exisiting text | Excel Worksheet Functions | |||
Can word wrap and merged cells auto row height properly in Excel | Excel Discussion (Misc queries) | |||
Excel - merged cells w/wrapped text auto row height doesn't work. | Excel Discussion (Misc queries) |