Auto Adjust Row Height based on Wrapped Text Sentences

nhinx

New Member
Joined
Aug 25, 2016
Messages
40
Office Version
  1. 2010
Dear Excel Experts,

I tried the code below to automatically adjust the row height in merged cell from A10 to G10. For example, if my sentence is justified in 2 lines only the row height will adjust for 2 liner sentences. Then if my write ups could go longer (example: 6 lines sentences) it should also adjust based on that data.

Range("A10:G10").EntireRow.AutoFit
Range("A10:G10").WrapText = True

However, the code doesn't seems to work.

Can you help me resolve this problem?

Thanks,
Nhinx
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I found after setting wrap text on cells A1 to A3 as I added text the row height increased and when I deleted some of the text the row height automatically adjusted
 
Upvote 0
Hi Oldbrewer,

That is possible if your cells are not merged. But for the merged cells, you need a vba code to do that.
 
Upvote 0
I'll start again

 
Last edited:
Upvote 0
You need to unmerge your cells then remerge them to get autofit to work. This directly from MS
In Excel, you cannot use the AutoFit feature on a column that contains a cell merged with cells in other columns. Likewise, you cannot use AutoFit on a row that contains a cell merged with cells in other rows.
Merged cells are schitzo.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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