none
Autofit VBA to determine row height RRS feed

  • Question

  • I have an Excel 2013 worksheet where Columns A:E need to be autofit by HEIGHT & NOT WIDTH.  Of course, the values in the columns will always vary (this is a template used for contracts).

    This code just makes the columns very wide:

    Worksheets("Customer Email ").Range("A2:E6").Columns.AutoFit

    Can anyone help?

    Thanks!


    A. Wolf

    Tuesday, February 10, 2015 11:48 PM

Answers

  • For height to be autofitted, Wrap Text must be turned on. So try

        With Worksheets("Customer Email ").Range("A2:E6")
            .WrapText = True
            .EntireRow.AutoFit
        End With

    By the way, are you sure that there is a space after the sheet name?


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Wednesday, February 11, 2015 7:06 AM

All replies

  • For height to be autofitted, Wrap Text must be turned on. So try

        With Worksheets("Customer Email ").Range("A2:E6")
            .WrapText = True
            .EntireRow.AutoFit
        End With

    By the way, are you sure that there is a space after the sheet name?


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Wednesday, February 11, 2015 7:06 AM
  • Hans:

    Lines are appearing cut off, as in, only half the text is visible.  Is there any fix for this?

    Thanks again!

    Amy

    ====


    A. Wolf

    Wednesday, February 11, 2015 4:45 PM
  • Not that I know of.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Wednesday, February 11, 2015 5:17 PM
  • Hi Amy,

    The new issue is not related to the original issue, I suggest that you should open a new thread.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, February 12, 2015 3:10 AM
    Moderator