EXCEL中如何在这段VBA代码中添加字体加粗的命令

Sub Ss()
Dim c As Range
n = InputBox("请输入需改变颜色的词语:")
If n = "" Then Exit Sub
For Each c In ActiveSheet.UsedRange
i = 1
While InStr(i, c, n, 0) > 0
i0 = InStr(i, c, n, 0)
If i0 > 0 Then c.Characters(i0, Len(n)).Font.Color = vbRed: i = i0 + Len(n)
Wend
Next
End Sub

这段改一下If i0 > 0 Then c.Characters(i0, Len(n)).Font.Color = vbRed: i = i0 + Len(n)
改成
If i0 > 0 Then
c.Characters(i0, Len(n)).Font.Color = vbRed: i = i0 + Len(n)
c.Characters(i0, Len(n)).Font.bold=true
end if
温馨提示:答案为网友推荐,仅供参考
相似回答