|
Sub HighlightKeyword()
Dim searchRange As Range
Dim searchValue As String
Dim cell As Range
' 设置搜索范围为A列
Set searchRange = ThisWorkbook.Sheets("Sheet1").Range("A:A")
' 弹窗录入关键词
searchValue = InputBox("请输入要查找的关键词:")
' 如果关键词不为空,则进行查找
If searchValue <> "" Then
' 在A列中查找关键词
For Each cell In searchRange
If cell.Value = searchValue Then
' 如果找到,字体加红
cell.Font.Color = RGB(255, 0, 0)
End If
Next cell
End If
End Sub |
|