AutoFit row height not working- Cell not merged, with wrap text, already clicked auto-fit

Rachelle 21 Reputation points
2022-04-22T16:19:06.857+00:00

I am self taught with Excel so I am hoping I can make sense and that someone can help me.

I have an excel document that I formulated for making pay packages for my job. On a second tab, the contract is filled via the information on tab 1. Part of it is a section that is "free typing" for stipulations that usually take 2-4 lines. I have unlocked the cell, cleared the formatting, clicked "AutoFit" on row height, wrap text, and there are not any merged cells in the location. All that being said, it will not auto-fit, rather I have to go to the contract tab and double click the row and then it does but often will be larger than the text.

Any advice to make this happen automatically as in my experience it usually works this way.

Thank you in advance

Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,645 questions
{count} votes

Accepted answer
  1. Emily Hua-MSFT 27,526 Reputation points
    2022-04-29T08:31:13.843+00:00

    Hi @Rachelle

    Sorry for the delay.

    > Then I have B76 pull via formula, from M76.

    Does the cell highlighted in green is M76?
    I still confused how M76 get the data from B76, do you refer to “Automatic Row Height For Merged Cells with Text Wrap”, then you enter "=B76“ formula in M76?
    (Please Note: Since the web site is not hosted by Microsoft, the link may changed without notice. Microsoft does not guarantee the accuracy of this information.)
    If yes and M76 does not include the merge cells (Rows with Merged cells will not Autofit or Wrap text), I would suggest you use VBA code to wrap the text in helper column instead.

    I have following sample as the gif. On Sheet1, I need to show all text in B2 to B3 which includ merged cells, then I use code to wrap text of cells F2 to F3.

    197731-9.gif

    The code is as below. You can copy your workbook, and then press Alt + F11, double click "This Workbook" and copy following code and change the cell range to have a test.

    Sub Autofit()  
    
      Worksheets("Sheet1").Range("F2:F3").WrapText = True  
    
    End Sub  
    

    197638-10.gif

    But, as the method need to add helper coloum, this may cause an extra blank sheet of paper when printing.
    It's best to set one or more print areas.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Rachelle 21 Reputation points
    2022-04-25T16:26:17.33+00:00

    It will not let me attach an excel document but I can send snips of it.

    On the first snip, I have highlighted in pink where the initial information is being entered with the settings as the second snip attached.

    Then on the next part is where the formula comes in. On the third snip, in B76 in pink, I have the cells merged so I cannot do a wrap text so I am working on the work around. In green, M76 is where I have the formula to copy from the Pay Package, tab 1 and cell L3, but in white so that that cell does the wrap text which inadvertently sizes the column where it won't resize itself due to the merg. Then I have B76 pull via formula, from M76. This works IF I double click the row but then prints odd because of me using the work-around and again, I want it to autofit every time. Also, because of the work-around, it prints with a last blank page.

    Thank you for all your help in advance!

    ![196271-snip-1.png]2
    196247-snip-2.png
    196208-snip-3.png

    0 comments No comments

  2. Rachelle 21 Reputation points
    2022-05-03T17:58:05.487+00:00

    I just did my first Macros with this and I believe it worked but it is making the cell quite large. Is there something I did wrong maybe?198602-screenshot-2022-05-03-135349.png

    Thank you so so much for all your help!

    @Emily Hua-MSFT

    Update: I tried using it a second time by running macros again and it did not work the second time. I did not do the ('sheet2!A2") because it did not work due to needing another piece to that formula Indirect(ref_text, [a1]).

    0 comments No comments