Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a worksheet that has rows formatted to auto fit and cells formatted to
word wrap, but the cells do not auto adjust to input data. The column is set to a width of 40. If the input string is over 39 characters long, the cell stays 1 row high until the character length exceeds 51. I have tried the attached code from Gord Dibben, but it does not resolve the problem. Private Sub Worksheet_Change(ByVal Target As Range) Dim NewRwHt As Single Dim cWdth As Single, MrgeWdth As Single Dim c As Range, cc As Range Dim ma As Range With Target If .MergeCells And .WrapText Then Set c = Target.Cells(1, 1) cWdth = c.ColumnWidth Set ma = c.MergeArea For Each cc In ma.Cells MrgeWdth = MrgeWdth + cc.ColumnWidth Next Application.ScreenUpdating = False ma.MergeCells = False c.ColumnWidth = MrgeWdth c.EntireRow.AutoFit NewRwHt = c.RowHeight c.ColumnWidth = cWdth ma.MergeCells = True ma.RowHeight = NewRwHt cWdth = 0: MrgeWdth = 0 Application.ScreenUpdating = True End If End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Word wrapping in Excel | Excel Discussion (Misc queries) | |||
Autofit doesn't work | Excel Discussion (Misc queries) | |||
How to make (XL) Merge Cells and Word Wrap work concurrently? | Excel Discussion (Misc queries) | |||
AutoFit rows issue | Excel Discussion (Misc queries) | |||
Text disappears when word wrap is used | Excel Discussion (Misc queries) |