Auto sizing on row height

Solar

Board Regular
Joined
Mar 11, 2003
Messages
90
I am pulling data in from an external DB to excel. I have a formula in a cell that is actually a merge of six adjacent cells. The formula concatenates the word "PM3" with the contents of another cell. I have the cell formatted to wrap text.

My issue is that when the sheet is run, if the text is longer than one row of data within the cell, it does wrap the text but the row height does not automatically change so that the entire data set can be seen. I am having to manually increase the row height.

What do I need to do to have the row height adjust automatically depending upon the length of the data in the row?

thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi,

This code cycles through the current worksheet and autofits the row height.

Code:
Sub test()

Dim myRow As Range

For Each myRow In ActiveSheet.UsedRange

myRow.Rows.AutoFit

Next myRow

End Sub

Might be of some use to you.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

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