wrap text not working!

npacker

Board Regular
Joined
Oct 14, 2004
Messages
132
Hi everyone,
Small problem. I have a worksheet that has different fields for the user to input text. One of the fields has all the cells for the whole row (as far as one page) merged. I put it on wrap text so that if the user types in more than one line, the cell would enlarge automatically and the text would wrap. But it's not working! The cells don't enlarge, and thext isn't wrapping! I opened up a blank worksheet and verified that the wrap text option is working. It works in another sheet, but my sheet isn't working! Any help?
Thanks,
Nate
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Barry Katcher

Well-known Member
Joined
Feb 25, 2002
Messages
4,053
I tried Aaron's work-around of creating an off-screen column the same width as the combined merged cells. The merged cells are in A2:C2 and the off-screen column is column D.

In D2, I entered the formula =A1, and formatted the cell to Wrap Text. When I added text to the merged cell, the formula in D2 did, of course, add the text to D2, but the row height was not automatically adjusted.

I was, however, able to use Format>Row>AutoFit to adjust the heright of the row. Am I missing something?

Perhaps adding a Selection_Change macro to autofit the row whenever the merged cell is edited?

Barry
 

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
8,021
Office Version
  1. 365
I get the same results, Barry. I guess we do need something like:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 1 Then Rows("1:1").EntireRow.AutoFit
End Sub

as well.
 

Barry Katcher

Well-known Member
Joined
Feb 25, 2002
Messages
4,053

ADVERTISEMENT

OakTree, that worked for me on my row 2. Nice.

Now, how about this scenario: if there is more than one row with this merged-cell situation, can your macro be modified to handle editing of any or all of those cells?

Barry
 

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
8,021
Office Version
  1. 365
Not sure you'd necessarily want to autofit the height of EVERY row with a merged cell, but if there are a handful, perhaps:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyArray, MyRow
MyArray = Array(1, 2, 4, 5, 8, 10)
MyRow = Application.Match(Target.Row, MyArray, 0)
If Not IsError(MyRow) Then Rows(Target.Row & ":" & Target.Row).EntireRow.AutoFit
End Sub
 

Forum statistics

Threads
1,148,220
Messages
5,745,456
Members
423,952
Latest member
EduardoM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top