Autofit row height

G

Guest

I have a spreadsheet (call MainForm) contain data from col A - H with "wrap
text" option on. Column A, B receive data from user input while column C, D &
E receive data via a hyperlink to 2 separate spreadsheet as shown in sample
below:
='C:\$User\[Issue 01.xls]EntryForm'!$H$5
='C:\$User\[Issue 01.xls]EntryForm'!$L$5
='C:\$User\[Issue 01.xls]EntryForm'!$M$5
Cell (H5, L5 & M5) are cell contain text data.

I use the following loop to adjust the row height in each cell of the MainForm

For i=Start_Row to End_Row
Rows(CStr(i) & ":" & CStr(i)).EntireRow.AutoFit
Next i

I found that NOT all row height are correctly adjusted. For example, if one
of the cells in a row contains 5 rows of data within that cell it display
only 3 wrapped lines of data within the cell in stead of 5 as I expected.
This problem is very consistent in the linked cells.

Can someone please tell me how can I correct this problem s.t. when the loop
is complete, all rows' height are correctly adjusted with its max lines of
wrapped text displayed ?

Thanks in advance for any assistance.
 
G

Guest

No. None of the cells are merged.

Tom Ogilvy said:
Do you have merged cells?

Autofit doesn't work with merged cells.

--
Regards,
Tom Ogilvy
Wellie said:
I have a spreadsheet (call MainForm) contain data from col A - H with "wrap
text" option on. Column A, B receive data from user input while column C, D &
E receive data via a hyperlink to 2 separate spreadsheet as shown in sample
below:
='C:\$User\[Issue 01.xls]EntryForm'!$H$5
='C:\$User\[Issue 01.xls]EntryForm'!$L$5
='C:\$User\[Issue 01.xls]EntryForm'!$M$5
Cell (H5, L5 & M5) are cell contain text data.

I use the following loop to adjust the row height in each cell of the MainForm

For i=Start_Row to End_Row
Rows(CStr(i) & ":" & CStr(i)).EntireRow.AutoFit
Next i

I found that NOT all row height are correctly adjusted. For example, if one
of the cells in a row contains 5 rows of data within that cell it display
only 3 wrapped lines of data within the cell in stead of 5 as I expected.
This problem is very consistent in the linked cells.

Can someone please tell me how can I correct this problem s.t. when the loop
is complete, all rows' height are correctly adjusted with its max lines of
wrapped text displayed ?

Thanks in advance for any assistance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top