Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Wrap text in merged cells

I have a file where I have merged cells a10:d:10 and formatted it to wrap text.
My problem is that the row-height not changes automatically, which always
happends if I wrap text in cells that are not merged.
I there any sulotion for this?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Wrap text in merged cells

The best solution is not to use merged cells - they're far more trouble
than they're worth. If you're merging in order to center a title, do
this instead: put the title in A1. Select A1:D1. Choose
Format/Cells/Alignment and select "Center Across Selection" from the
Horizontal dropdown.

If you need to keep the cells merged, then you'll need to use something
like this macro by Jim Rech:

http://groups.google.com/group/micro...amming/browse_
frm/thread/a5cbe0ee8e6c2a10/93c6bca447bd8902#93c6bca447bd8902

(or http://elfurl.com/2gguv, if the above linewrapped link doesn't work)

In article ,
Lena_Office wrote:

I have a file where I have merged cells a10:d:10 and formatted it to wrap
text.
My problem is that the row-height not changes automatically, which always
happends if I wrap text in cells that are not merged.
I there any sulotion for this?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Wrap text in merged cells

Is there any way to get this macro to run automatically while pressing Enter
after typing a long sentence?
I get the macro to work, but only if I create a Button to run it from.

"JE McGimpsey" skrev:

The best solution is not to use merged cells - they're far more trouble
than they're worth. If you're merging in order to center a title, do
this instead: put the title in A1. Select A1:D1. Choose
Format/Cells/Alignment and select "Center Across Selection" from the
Horizontal dropdown.

If you need to keep the cells merged, then you'll need to use something
like this macro by Jim Rech:

http://groups.google.com/group/micro...amming/browse_
frm/thread/a5cbe0ee8e6c2a10/93c6bca447bd8902#93c6bca447bd8902

(or http://elfurl.com/2gguv, if the above linewrapped link doesn't work)

In article ,
Lena_Office wrote:

I have a file where I have merged cells a10:d:10 and formatted it to wrap
text.
My problem is that the row-height not changes automatically, which always
happends if I wrap text in cells that are not merged.
I there any sulotion for this?


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Wrap text in merged cells

Lena

Here is event code from Greg Wilson that runs when you ENTER out of a merged
cell.

Note: wrap text format must be preset on the merged cells.

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

This is event code. Right-click on the sheet tab and "View Code".

Copy/paste the above into that sheet module.


Gord Dibben MS Excel MVP


On Thu, 15 Mar 2007 06:41:02 -0700, Lena_Office
wrote:

Is there any way to get this macro to run automatically while pressing Enter
after typing a long sentence?
I get the macro to work, but only if I create a Button to run it from.

"JE McGimpsey" skrev:

The best solution is not to use merged cells - they're far more trouble
than they're worth. If you're merging in order to center a title, do
this instead: put the title in A1. Select A1:D1. Choose
Format/Cells/Alignment and select "Center Across Selection" from the
Horizontal dropdown.

If you need to keep the cells merged, then you'll need to use something
like this macro by Jim Rech:

http://groups.google.com/group/micro...amming/browse_
frm/thread/a5cbe0ee8e6c2a10/93c6bca447bd8902#93c6bca447bd8902

(or http://elfurl.com/2gguv, if the above linewrapped link doesn't work)

In article ,
Lena_Office wrote:

I have a file where I have merged cells a10:d:10 and formatted it to wrap
text.
My problem is that the row-height not changes automatically, which always
happends if I wrap text in cells that are not merged.
I there any sulotion for this?



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Wrap text in merged cells

Thanks!
Now I understand.

"Gord Dibben" skrev:

Lena

Here is event code from Greg Wilson that runs when you ENTER out of a merged
cell.

Note: wrap text format must be preset on the merged cells.

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

This is event code. Right-click on the sheet tab and "View Code".

Copy/paste the above into that sheet module.


Gord Dibben MS Excel MVP


On Thu, 15 Mar 2007 06:41:02 -0700, Lena_Office
wrote:

Is there any way to get this macro to run automatically while pressing Enter
after typing a long sentence?
I get the macro to work, but only if I create a Button to run it from.

"JE McGimpsey" skrev:

The best solution is not to use merged cells - they're far more trouble
than they're worth. If you're merging in order to center a title, do
this instead: put the title in A1. Select A1:D1. Choose
Format/Cells/Alignment and select "Center Across Selection" from the
Horizontal dropdown.

If you need to keep the cells merged, then you'll need to use something
like this macro by Jim Rech:

http://groups.google.com/group/micro...amming/browse_
frm/thread/a5cbe0ee8e6c2a10/93c6bca447bd8902#93c6bca447bd8902

(or http://elfurl.com/2gguv, if the above linewrapped link doesn't work)

In article ,
Lena_Office wrote:

I have a file where I have merged cells a10:d:10 and formatted it to wrap
text.
My problem is that the row-height not changes automatically, which always
happends if I wrap text in cells that are not merged.
I there any sulotion for this?





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Wrap text in merged cells

No happines lasts forever! When I started to work in my file, someting new
showed up.
After entering a text, which wraps perfectly I need to Delete the content in
the cell, and presses Delete. Excel gives me the message that the cell I try
to change is locked.
For some reason, that I can not understand, the merged cell that from the
start is formatted "not locked" now is formated like the cell both is locked
and not (the square is grey). This also happends when I unmerge and then
merge manually.

It is not logical since it works fore some merged cells but not for all in
the same worksheet.
If anyone understands what I am trying to explain, please help!

"Lena_Office" skrev:

Thanks!
Now I understand.

"Gord Dibben" skrev:

Lena

Here is event code from Greg Wilson that runs when you ENTER out of a merged
cell.

Note: wrap text format must be preset on the merged cells.

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

This is event code. Right-click on the sheet tab and "View Code".

Copy/paste the above into that sheet module.


Gord Dibben MS Excel MVP


On Thu, 15 Mar 2007 06:41:02 -0700, Lena_Office
wrote:

Is there any way to get this macro to run automatically while pressing Enter
after typing a long sentence?
I get the macro to work, but only if I create a Button to run it from.

"JE McGimpsey" skrev:

The best solution is not to use merged cells - they're far more trouble
than they're worth. If you're merging in order to center a title, do
this instead: put the title in A1. Select A1:D1. Choose
Format/Cells/Alignment and select "Center Across Selection" from the
Horizontal dropdown.

If you need to keep the cells merged, then you'll need to use something
like this macro by Jim Rech:

http://groups.google.com/group/micro...amming/browse_
frm/thread/a5cbe0ee8e6c2a10/93c6bca447bd8902#93c6bca447bd8902

(or http://elfurl.com/2gguv, if the above linewrapped link doesn't work)

In article ,
Lena_Office wrote:

I have a file where I have merged cells a10:d:10 and formatted it to wrap
text.
My problem is that the row-height not changes automatically, which always
happends if I wrap text in cells that are not merged.
I there any sulotion for this?



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
Auto adjusting merged cells with wrap text on Sony Excel Discussion (Misc queries) 1 August 24th 06 04:15 PM
text wrap in merged cells SteveFerd Excel Discussion (Misc queries) 3 July 16th 05 12:46 PM
text wrap w/ merged cells Dahlman Excel Discussion (Misc queries) 3 April 18th 05 08:37 PM
Rows with merged cells are not adjusting even w/ Wrap Text and au. mkern20 Excel Discussion (Misc queries) 1 January 4th 05 08:10 PM
How do I "Wrap Text" & "Autofit" within Merged Cells in Excel? 6-shooter Excel Worksheet Functions 3 October 31st 04 12:14 AM


All times are GMT +1. The time now is 02:03 PM.

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

About Us

"It's about Microsoft Excel"