-1
我想更改单元格中最后一个字符的字体。 为此,我尝试了下面的代码。但不工作。 请帮忙。如何更改单元格中最后一个字符的字体?
Right(Sheet1.Cells(i, 9), 1).Font.ColorIndex = 3
我想更改单元格中最后一个字符的字体。 为此,我尝试了下面的代码。但不工作。 请帮忙。如何更改单元格中最后一个字符的字体?
Right(Sheet1.Cells(i, 9), 1).Font.ColorIndex = 3
得到答案现在:) 下面是解决方案:
Sheet1.Cells(i, 9).Characters(Len(Sheet1.Cells(i, 9).Value), 1).Font.ColorIndex = 3
感谢。
请试试这个:
Sub ColorTextv()
Dim i As Long
Dim text As String
' Change as per your requrement. I used it for testing purpose
text = Cells(1, 9).Value
For i = 1 To Len(text)
If i = Len(text) Then
Cells(1, 9).Characters(i, 9).Font.ColorIndex = 3
'You can change by mentioning color also
'Cells(1, 9).Characters(i, 9).Font.Color = vbRed
End If
Next
End Sub