某个单元格的部分字符变色,就要利用Characters(开始位置,结束位置).font.color 进行赋值
(2012-09-11 19:29:56)
标签:
某个单元格的部分字符杂谈 |
Private Sub CommandButton2_Click()
Dim i As Long
Dim m As Long, numA As Integer,
numB As Integer
Dim strA As String
For i = 1 To
[a65536].End(3).Row
numA = InStr(Cells(i, "A"), "=")
If numA = 0 Then GoTo numAErr0
numB = InStr(numA, Cells(i, "A"), "-")
If numB > 0 And IsNumeric(Mid(Cells(i, "A"),
numB + 1, 1)) Then
strA =
Str(Val(Right(Cells(i, "A"), Len(Cells(i, "A")) - numB)))
Cells(i,
"A").Characters(numB, Len(strA)).Font.Color =
vbRed
'如果要将某个单元格的部分字符变色,就要利用Characters(开始位置,结束位置).font.color
进行赋值
End If
numAErr0:
Next
End Sub
numAErr0:
End Sub