ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofit row height (https://www.excelbanter.com/excel-programming/324180-autofit-row-height.html)

Wellie

Autofit row height
 

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.




Tom Ogilvy

Autofit row height
 
Do you have merged cells?

Autofit doesn't work with merged cells.

--
Regards,
Tom Ogilvy
"Wellie" wrote in message
...

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.






Wellie

Autofit row height
 
No. None of the cells are merged.

"Tom Ogilvy" wrote:

Do you have merged cells?

Autofit doesn't work with merged cells.

--
Regards,
Tom Ogilvy
"Wellie" wrote in message
...

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.








All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com