Forum Discussion

ShrinivasIyer's avatar
ShrinivasIyer
Copper Contributor
Jul 12, 2019

auto row height adjust when doing wrap text

Hi Team,

Thanks for looking into it.

 

When I do wrap text in few cells the row height doesn't auto change to show all text content in the cells.

Please guide, Thanks

I am using Office 365, WIN10

 

 

5 Replies

  • Kodipady's avatar
    Kodipady
    Iron Contributor

    ShrinivasIyer 

    Normally column height auto change does not happen if you change column height manually by dragging the height.  As a work around , you can copy a row that behaves correctly and format paint on the row where you need auto change to happen. 

     

    Not a perfect solution, but it works for me. 

  • Thomas Urtis's avatar
    Thomas Urtis
    Copper Contributor

    ShrinivasIyer 

    In some cases a formatting coercion needs a nudge, depending on the data and its formatting such as merged cells or some other factor you are unaware of. This might or might not be one of those cases, but to make sure, try this:

     

    First, if this is not a macro enabled workbook (with the .xlsm extension), please save the workbook as that workbook type.

     

    Next, for the worksheet where you want this behavior to be applied, right-click the sheet tab, left click onto View Code, and paste the below code into the large white area that is the worksheet module. Then press Alt+Q to return to the worksheet and test the code by entering some lengthy string of words whose length would exceed the width of the target column.

     

    Personally, I don't think VBA should be the solution to what you are experiencing, but this is a starting point, as a troubleshooting tactic more than anything, to at least make sure that what you are entering can be presented in a row whose height is what you would expect.

     

    Private Sub Worksheet_Change(ByVal Target As Range)
    Application.ScreenUpdating = False
    With Target
    .VerticalAlignment = xlCenter
    .WrapText = True
    Rows(.Row).AutoFit
    End With
    Application.ScreenUpdating = True
    End Sub
    • ShrinivasIyer's avatar
      ShrinivasIyer
      Copper Contributor

      Thomas Urtis Thanks Thomas.

      I entered the worksheet change event macros and tried again but it didnt work.

      Even if the macros had worked it would be a temporary solution. I have faced this issue many times in past few years. Not sure why MS is unable to solve it yet.

  • ShrinivasIyer 

     

    Hi, you can adjust the height using formatting. A little guide below, this may help.

     

    https://support.office.com/en-us/article/wrap-text-in-a-cell-2a18cff5-ccc1-4bce-95e4-f0d4f3ff4e84

Resources