Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Wrapping Text in Merged Cells - Excel 2002

I have merged cells which have condiational formatting applies, the wrap text
is checked and the text will not wrap.

I have tried a few of the macros which were mentioned in other questions
with no success.

Anyone have any suggestions.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Wrapping Text in Merged Cells - Excel 2002

Wrap text text works fine in merged cells.

However.............autofitting of row height does not work.

See google search thread for code by Greg Wilson. Watch out for word wrap
in the URL which is all one line.

http://groups.google.com/group/micro...1c160cbeb27874

If this code is one of the macros you tried, please post back and explain
what is or is not happening.


Gord Dibben MS Excel MVP

On Thu, 30 Apr 2009 11:34:25 -0700, Cornelia
wrote:

I have merged cells which have condiational formatting applies, the wrap text
is checked and the text will not wrap.

I have tried a few of the macros which were mentioned in other questions
with no success.

Anyone have any suggestions.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Wrapping Text in Merged Cells - Excel 2002

Hi Gord,

I cut and pasted the macro below and I am getting a error on the ----
ma.MergeCells = False ---- line, any suggestions?


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" wrote:

Wrap text text works fine in merged cells.

However.............autofitting of row height does not work.

See google search thread for code by Greg Wilson. Watch out for word wrap
in the URL which is all one line.

http://groups.google.com/group/micro...1c160cbeb27874

If this code is one of the macros you tried, please post back and explain
what is or is not happening.


Gord Dibben MS Excel MVP

On Thu, 30 Apr 2009 11:34:25 -0700, Cornelia
wrote:

I have merged cells which have condiational formatting applies, the wrap text
is checked and the text will not wrap.

I have tried a few of the macros which were mentioned in other questions
with no success.

Anyone have any suggestions.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Wrapping Text in Merged Cells - Excel 2002

I would guess the sheet is protected.

Try this version.

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
On Error GoTo endit
ActiveSheet.Unprotect Password:="justme"
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
endit:
ActiveSheet.Protect Password:="justme"
End Sub


Gord

On Mon, 11 May 2009 10:15:02 -0700, Cornelia
wrote:

Hi Gord,

I cut and pasted the macro below and I am getting a error on the ----
ma.MergeCells = False ---- line, any suggestions?


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" wrote:

Wrap text text works fine in merged cells.

However.............autofitting of row height does not work.

See google search thread for code by Greg Wilson. Watch out for word wrap
in the URL which is all one line.

http://groups.google.com/group/micro...1c160cbeb27874

If this code is one of the macros you tried, please post back and explain
what is or is not happening.


Gord Dibben MS Excel MVP

On Thu, 30 Apr 2009 11:34:25 -0700, Cornelia
wrote:

I have merged cells which have condiational formatting applies, the wrap text
is checked and the text will not wrap.

I have tried a few of the macros which were mentioned in other questions
with no success.

Anyone have any suggestions.




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
Wrapping Text in Merged Cells - Excel 2002 Cornelia Excel Discussion (Misc queries) 0 April 30th 09 07:06 PM
wrapping text in merged cells Ann Excel Discussion (Misc queries) 2 April 3rd 08 04:51 PM
Wrapping text in merged cells Taza Excel Discussion (Misc queries) 3 January 16th 07 08:56 AM
wrapping of very long text in EXCEL 2002 cells prjman Excel Discussion (Misc queries) 3 June 15th 06 08:51 PM
How can I Excel to re-size when wrapping text in merged cells Samjoy Excel Discussion (Misc queries) 4 February 4th 05 12:47 AM


All times are GMT +1. The time now is 12:20 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"