Excel批量加粗关键词(宏)
代码如下:
Sub 批量加粗()
Dim a As Range
Dim b As String
b = InputBox("请输入要加粗的关键字")
For Each a In ActiveSheet.UsedRange
If InStr(a.Value, b) > 0 Then
i = InStr(a.Value, b)
a.Characters(i, Len(b)).Font.Bold = True
End If
Next a
End Sub
用法:
视图 \(\Rightarrow\) 宏 \(\Rightarrow\) 填入宏名 \(\Rightarrow\) 新建 \(\Rightarrow\) 将代码粘入 \(\Rightarrow\) 保存 \(\Rightarrow\) 执行