Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
'Grow' a merged cell when display is full.
Hi,
I have several cells merged and set to wrap the text. I need the merged cells to grow with the amount of data. It does this if the cells are NOT merged, but not with merged cells. Does anyone have a solution please? Many thanks |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
'Grow' a merged cell when display is full.
Long audible sigh here.................
One more victim of "merged cells". Wrap Text works fine on merged cells, but Autofit does not work. You need VBA event code to do that. Here is code from Greg Wilson. 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 Gord Dibben MS Excel MVP On Mon, 25 Jun 2007 06:01:03 -0700, olwenh wrote: Hi, I have several cells merged and set to wrap the text. I need the merged cells to grow with the amount of data. It does this if the cells are NOT merged, but not with merged cells. Does anyone have a solution please? Many thanks |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
'Grow' a merged cell when display is full.
Thanks very much - I'll give it a go. Really grateful
"Gord Dibben" wrote: Long audible sigh here................. One more victim of "merged cells". Wrap Text works fine on merged cells, but Autofit does not work. You need VBA event code to do that. Here is code from Greg Wilson. 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 Gord Dibben MS Excel MVP On Mon, 25 Jun 2007 06:01:03 -0700, olwenh wrote: Hi, I have several cells merged and set to wrap the text. I need the merged cells to grow with the amount of data. It does this if the cells are NOT merged, but not with merged cells. Does anyone have a solution please? Many thanks |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
'Grow' a merged cell when display is full.
Works a treat - fantastic - thanks
"olwenh" wrote: Hi, I have several cells merged and set to wrap the text. I need the merged cells to grow with the amount of data. It does this if the cells are NOT merged, but not with merged cells. Does anyone have a solution please? Many thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Grow a range by # of lines by right click on grow tool & type num | Excel Discussion (Misc queries) | |||
how do i link merged cells to a merged cell in another worksheet. | Excel Worksheet Functions | |||
format a merged cell to grow (Heighth) | Excel Discussion (Misc queries) | |||
display multiple lines of text within a merged cell automatically | Excel Worksheet Functions | |||
How can I display and print all the data in a wrapped merged cell. | Excel Discussion (Misc queries) |