Home > Blockchain >  EXCEL VBA Vertical Text
EXCEL VBA Vertical Text

Time:01-05

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

CodePudding user response:

Change

.Orientation = 90

to

.Orientation = xlVertical

See the XlOrientation enumeration docs for more detail.

  •  Tags:  
  • Related