2

I'm attempting to rotate the text inside of a cell without altering the cell border.

Roughly the intended result:
Intended result
Current Output:
current result

The only solution I've found so far involves adding either splitting all columns or all rows by adding rows/columns in-between, then merging. If I have to, I Can do it, but I would prefer another option.

I'm quite comfortable with VBA if anyone has a programmatic solution.

EDIT:

My result after trying suggested fixes. Cell Border is still angled.
Attempt Two

0

5 Answers 5

2
+50

The only way I can see for having angled text within a square cell, is to take the text out of the cell.

The text would then be inside a Text Box that will itself be angled, and the box would be placed above a cell that is resized to fit the text box.

For easier resizing of the cell without the need to manually resize the text box, you might want to set the following in the Format Shape dialog of the text box:

  • In Shape Options > Size & Properties, under Properties, set "Move and size with cells"
  • In the same place, under Text Box, set "Resize shape to fit text"
  • Set other properties as required.
2
  • That's a pretty good option, let me see if I can streamline this. The first issue is I'm trying to do this to basically all cells on a worksheet, and they all already have their borders, second issue is moving everything to textboxes removes the option to calculate as you change things... unless... I make each text box equal to the underlying value... I'll try to program it. Commented Aug 8, 2022 at 23:43
  • Works, See My Answer. Commented Aug 9, 2022 at 23:14
2

Just use the Orientation tool on the Alignment dialog Format Cells => Alignment

enter image description here

If you are setting Borders which you need to keep straight, you will need to have your angled text in merged cells.

enter image description here

4
  • I understand how to angle the text, what I don't get is how to keep the cell border from angling. See above, I've edited by question after following the above steps. Commented Aug 5, 2022 at 17:43
  • 2
    @CameronCritchlow If you are using borders, you will need to merge two (or more) cells. Then the borders will remain rectangular. I will edit my answer to show this. Commented Aug 6, 2022 at 0:59
  • Do you know if there's any way to achieve this without merging cells. Commented Aug 8, 2022 at 17:47
  • 1
    @CameronCritchlow I do not know of any other way Commented Aug 8, 2022 at 18:43
0

There is this button in the Excel home tab. enter image description here

1
  • I understand how to angle the text, what I don't get is how to keep the cell border from angling. See above, I've edited by question after following the above steps. Commented Aug 5, 2022 at 17:45
0

Final Version of accepted answer, for anyone interested.

Sub ConvertCellTextToRotatedTextBox(Optional RG2 As Range)

    Dim I As Long
    Dim RG As Range
    Dim CL As Range
    Dim TextShape As Object
    
    If Not RG2 Is Nothing Then
        Set RG = RG2
    Else
        Set RG = Selection
    End If
    
    If RG.Cells.Count > 200 Then
        If MsgBox("You are trying to cycle through " & RG.Cells.Count & " Cells. Are you Sure???", _
            vbYesNo, "***WARNING***") = vbNo Then
                Exit Sub
        End If
    End If

    For Each CL In RG.Cells
        If CL.Value <> "" Then
            Set TextShape = ActiveSheet.Shapes.AddLabel(msoTextOrientationHorizontal, 129.75, 204, 72, 72)
            With TextShape
                .TextFrame2.TextRange.Characters.Text = CL.Value
                .TextFrame2.TextRange.ParagraphFormat.Alignment = msoAlignCenter
                .TextFrame2.VerticalAnchor = msoAnchorMiddle
                .Left = CL.Left
                .Top = CL.Top
                .Width = CL.Width
                .Height = CL.Height
                .Rotation = 5
                .Select
            End With
            Selection.Formula = "=" & CL.Address
            CL.Font.Color = CL.Interior.Color
        End If
    Next CL
    
    Exit Sub
    
ERRORHAND:
 MsgBox "Unknown Error", vbOKOnly, "ERROR:"
End Sub
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Aug 9, 2022 at 23:29
0

Clear the formatting of the cell first (including cell fill color, etc). Then after that, use the AB↑ again to rotate the text then use fill color in font section to color the cell.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Aug 27, 2023 at 11:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .