I'm trying to use the following code to change the font of the first letter only in each cell in a range to a specific font (which is a pie chart font) so that it appears a pie chart and then a value:
...but it changes the all the characters in each cell in the range, instead of just the first character.
The values in that range of cells are like this: "e 23.5%"
....produced by formulae like this:
How can I adjust the code so that only the first character is the pie chart font?
VBA Code:
Sub Set_Pie_first_char()
Dim r As Range
With Range("e27:i27")
For Each r In .Cells
r.Characters(Start:=1, Length:=1).Font.Name = "Pie charts for maps"
r.Characters(Start:=2, Length:=6).Font.Name = "Arial Nova"
Next
End With
End Sub
...but it changes the all the characters in each cell in the range, instead of just the first character.
The values in that range of cells are like this: "e 23.5%"
....produced by formulae like this:
Excel Formula:
=IF($B$25="Overall",
CHAR(CODE("a") + ROUND('Data & Calculations'!BB25*21,1))&" "&TEXT('Data & Calculations'!BB25,"#.0%"),
CHAR(CODE("a") + ROUND('Data & Calculations'!BB26*21,1))&" "&TEXT('Data & Calculations'!BB26,"#.0%"))
How can I adjust the code so that only the first character is the pie chart font?