Possible to autofit column/row widths of cells with line breaks (e.g. vbLf) so that individual lines are fully visible and not wrapped?

  • I hope this makes sense. I have a few lines of text separated by line breaks (vbLf) and want the column widths and row heights to adjust so that each line of text is fully visible, i.e. the column width is as wide as the longest line of text and the row height is as high as the number of lines of text. I've tried WrapText both ways. Thanks


    Code
    Dim well as Range, MyRange as Range
    
    For Each well In MyRange
        well.HorizontalAlignment = xlCenter
        well.VerticalAlignment = xlVAlignCenter
        well.WrapText = False
        MyRange.Columns.AutoFit
        MyRange.rows.AutoFit
    Next well

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!