Forum Discussion
auto row height adjust when doing wrap text
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
- ShrinivasIyerJul 16, 2019Copper 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.