Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / February 2007

Tip: Looking for answers? Try searching our database.

Wrap text does not adjust row height in merged cells.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul S. Natanson - 05 Feb 2007 17:02 GMT
When I set the format/alignment of a SINGLE (unmerged) Excel cell to select
"WrapedText", the row height adjusts upward, automatically, to accommodate
the greater height needed by the wrapped text.  (That's good/)

But if I select "WrappedText" for a MERGED cell (e.g., a cell made by
merging two side-by-side cells into one), the row height does NOT adjust.
In that case, if the text runs onto a second line, I cannot see that second
line unless I increase the row height MANUALLY.   (That's bad.)

So, my question is:  "How can I force the row height to adjust AUTOMATICALLY
when selecting "WrapText" in a merged cell that was made by merging two
side-by-side cells?".

PS:  I am a proficient VBA programmer and macro writer and I am willing to
write a macro to do this if I do not get any better suggestions.

Paul S. Natanson
1-908-630-+0406  (9AM-9PM eastern USA time)
paul628 (at) concentric (dot) net
February 5, 2007
Gord Dibben - 05 Feb 2007 18:23 GMT
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

>When I set the format/alignment of a SINGLE (unmerged) Excel cell to select
>"WrapedText", the row height adjusts upward, automatically, to accommodate
[quoted text clipped - 16 lines]
>paul628 (at) concentric (dot) net
>February 5, 2007
Paul S. Natanson - 05 Feb 2007 20:57 GMT
Excellent!  Thank you VERY much.  It works great.  I should have done this
YEARS ago.  Many thanks.  Paul

> Long audible sigh here.................
>
[quoted text clipped - 59 lines]
>>paul628 (at) concentric (dot) net
>>February 5, 2007
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.