Search code examples
excelword-wraprow-heightvba

Row height change makes columns unreadable


I need to display the first line of each row (column(F) in this case) in a readable format in order ensure I am working on the correct row.

The image below shows what happens when I change the row height. In this case the post_content column becomes unreadable. I have other columns with the same issue.

The data is read from other workbooks and sheets through VBA.

I have tried the statement below without any affect:

Worksheets("Sheet1").Range("F2").WrapText = True

I have been searching on "word Wrap" and "Row Height" and cannot find a solution.

Your input is very welcome, Thanks, CraigM

Unreadable because of a row height change.


Solution

  • Looks like the cell content is middle-aligned in the vertical direction. In addition to wrapping the text in the cell, set it to be top-aligned

    With Worksheets("Sheet1").Range("F2")
        .HorizontalAlignment = xlGeneral
        .VerticalAlignment = xlTop
        .WrapText = True
    End With
    

    You can find the command in the Alignment group of the Home ribbon and use the macro recorder to see what code it requires:

    enter image description here