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





Any ideas how I could fix this?
 

Some videos you may like

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,271
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
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,582
Messages
5,512,202
Members
408,885
Latest member
binduchekuri

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top