How do I make Autofit expand a row to fit wrapped text that's more than one line?

TMan293

New Member
Joined
Sep 14, 2016
Messages
6
I am filling a cell in a row with text, usually more than one sentence, and merging it with several other cells, wrapping the text and then autofitting the entire row.
This works perfectly, when the data is contained to one line. When there is more than one line the autofit doesn't expand the row height to fit the extra data.
I need my program to automatically expand the height of the row to accommodate multiple lines of data in that row.
Here is a sample of my routine language for review:

ws1.Range("i" & I, "i" & x).Copy Destination:=ws.Cells(17, 2)

With ws.Range("b" & 17, "b" & 21)
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.WrapText = True
End With
ws.Range("b" & 17, "j" & 17).Merge
ws.Range("b" & 17, "j" & 17).WrapText = True
ws.Range("b" & 17, "j" & 17).EntireRow.AutoFit

It looks like this:
The eggs are most likely too old to use.The eggs are most likely too old to use.
There is too much information to fit on one line, so I have to manually expand it to fit. There is too much information to fit on one line, so I have to manually expand it to fit. There is too much information to
The eggs are fine.

and I want it to look like this:
The eggs are most likely too old to use.
There is too much information to fit on one line, so I have to manually expand it to fit. There is too much information to fit on one line, so I have to manually expand it to fit. There is too much information to fit on one line, so I have to manually expand it to fit. There is too much information to fit on one line, so I have to manually expand it to fit.
The eggs are fine.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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
Back
Top