cell formatting in excel

hi there

we generate a report form our company file and export this to excel - we would like to have a macro that automatically formatted cells in a particular range so that the text is vertical from top to bottom, and then for the row to be automatically justified.

Is this possible?

The cell range we would like to amend is from $I$3:$FS$3

thanks fo ryour help
Rossco_milkbarAsked:
Who is Participating?
 
Ejgil HedegaardConnect With a Mentor Commented:
Standard is bottom display, but you specified "vertical from top to bottom", that is why I thought it was the intention.
Change xlTop to xlBottom.

Only showing partial text can have more reasons.
Some text fonts, and if Bold, does not always set the correct row height when Autofit is used, or WrapText = False should be True.
Sometimes to Autofit (=double click between 2 row numbers) need to have the rows higher than needed before used, don't know why.

Try doing the setting manually, and record a macro when doing it, it will look like the code above.
Just mark one cell, then copy the code between "With Selection" and "End With" (all the lines starting with a dot) and insert it between "With Range("I3:FS3")" and "End With", replacing all the dot lines.
0
 
Ejgil HedegaardCommented:
Something like this

Sub RotateTextRow3()
    With Range("I3:FS3")
        .HorizontalAlignment = xlGeneral
        .VerticalAlignment = xlTop
        .WrapText = False
        .Orientation = 90
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Rows("3:3").EntireRow.AutoFit
End Sub

Open in new window

0
 
Rossco_milkbarAuthor Commented:
Thanks Hgholt - works great, except the display of the cells need to be oriented to the bottom of the cell - currently it is shown at the top of the cell and only show partial text.

Can you make a slight modification??

Thanks!!!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.