-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