Autofit row height problem

ljungren13

Board Regular
Joined
Jun 4, 2010
Messages
195
I have a userform that takes data and puts it into a cell, one of those inputs is a field called "description" which can get to be pretty long... I have it so it puts it into a long wrapped text cell and the cell will grow and autofit when its submitted the problem is that it is autofitting and cutting off some of the text... this picture shows how excel is autofitting it

thisis5letters-701.JPG




Any ideas how I could fix this?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,450
Maybe add some code like this...
Code:
    Columns("B:B").WrapText = True
    Columns("B:B").ColumnWidth = 100
    Cells.Rows.AutoFit
 

ljungren13

Board Regular
Joined
Jun 4, 2010
Messages
195
Yeah, i tried that and it doesn't seem to be doing it. I searched a little bit and what I found out is that the autofit, autofits a cell down to roughly 1000 characters even if there are more characters in the single cell.

Heres what I am kind of working on to fix my problem and it seems to be doing the trick:

Rich (BB code):
Private Sub addpackage2_Click()  
Dim i As Long
Dim s As Long
  'set range value
  Range("B8").Value = Description.Value
   'fix description row height
    With Range("B8").EntireRow
        .AutoFit
    End With
 
    s = Len(Description.Value) / 1000
    For i = 1 To s
       GrowCell
 Next
End Sub
 
Sub GrowCell()
With Sheets("Details").Range("B25")
 .RowHeight = .RowHeight + 55
End With
End Sub

Because the autofit recorrects to around 1000 characters I took the total character length and divided it by 1000 and then added 55 to the row height (roughly the height of 1000 characters) the same number of times that 1000 characters appears in the cell

If anyone else has a better solution I would glady accept it
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,453
Messages
5,837,355
Members
430,496
Latest member
Steph_88

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
Top