Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default '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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default '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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default '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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default '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
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
Grow a range by # of lines by right click on grow tool & type num David Thyer Excel Discussion (Misc queries) 12 August 15th 06 11:31 PM
how do i link merged cells to a merged cell in another worksheet. ibbm Excel Worksheet Functions 3 April 27th 06 11:40 PM
format a merged cell to grow (Heighth) sjuncker Excel Discussion (Misc queries) 1 February 6th 06 10:38 PM
display multiple lines of text within a merged cell automatically sssizemore Excel Worksheet Functions 1 June 15th 05 02:30 AM
How can I display and print all the data in a wrapped merged cell. lflinders Excel Discussion (Misc queries) 1 January 6th 05 02:05 AM


All times are GMT +1. The time now is 09:54 PM.

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

About Us

"It's about Microsoft Excel"