cjwrk
cjwrk

Reputation: 295

EXCEL VBA Vertical Text

I'm just wondering if it's possible to set a text as VERTICAL TEXT when the MergeCells script is used.

The MergeCells' output resembles the Official Town Fiesta and Bonifacio Day. However, the desired output must resemble the All Saints' and All Souls' Day columns.

Picture

Sub MergeCells()
    Application.ScreenUpdating = False
    ActiveSheet.Unprotect "123"
    
    With Selection
        .Merge
        .HorizontalAlignment = xlGeneral
        .VerticalAlignment = xlCenter
        .ShrinkToFit = True
        .Orientation = 90
     End With
 
    ActiveSheet.Protect "123", AllowFormattingColumns:=True, AllowFormattingRows:=True, AllowFormattingCells:=True
    Application.ScreenUpdating = True
End Sub

Upvotes: 0

Views: 2562

Answers (1)

BigBen
BigBen

Reputation: 50042

Change

.Orientation = 90

to

.Orientation = xlVertical

See the XlOrientation enumeration docs for more detail.

Upvotes: 2

Related Questions