Auto Adjust Row Height based on Wrapped Text Sentences

nhinx

Board Regular
Joined
Aug 25, 2016
Messages
55
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

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
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,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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