Search code examples
stringexcelformatcellvba

excel vba select second to last character in a cell


I thought this would be simple but can't find the solution anywhere! I am writing a macro to insert a red tick (or down arrow) after the existing text in a cell.

 ActiveCell.FormulaR1C1 = ActiveCell & " P "

The P needs to be formatted bold, red and Wingdings 2. It needs a space after it in case text is added at the end in the future.

No problem if it is before the text:

With ActiveCell.Characters(Start:=2, length:=1).Font

How can I select it when it is the second to last character in the cell?

(Or is there any other way to achieve this?)


Solution

  • Try this:

    With ActiveCell.Characters(ActiveCell.Characters.count - 1, 1).Font
      .name = "Wingdings 2"
      .Bold = True
    End With