It depends on how big the data is and what is the width of the column. Reason being the max height a row can expand is to 409.5 (546 pixels)
. If you manually increase the height of the row, you will notice that after a particular height, you will not be able to increase the height of the row. Check what is that height :) Same is the concept with the width. This is applicable to both rows and columns. In case of columns the max width is 254.86 (1789 pixels)
I used this code for demonstration purpose.
Option Explicit
Sub Sample()
ActiveCell.WrapText = True
ActiveCell.EntireRow.AutoFit
MsgBox ActiveCell.RowHeight
End Sub
See this screenshot
This works
This doesn't
The row has reach it's maximum. It cannot go beyond that.
The best way to handle this is to increase the width of the column.
FOLLOWUP
The reason why it was not working is because you had multiple columns with data in that row and you were trying to just set the WrapText of 1 cell and hence it was not working. When you have multiple columns of data you have to use cell.EntireRow.WrapText = True
instead of ActiveCell.WrapText = True
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…