是否可以让 Excel 突出显示搜索结果或您正在寻找的特定文本?我非常欣赏 Firefox 和 IntelliJ IDEA 中的这些功能。
答案1
我用谷歌搜索了您的需求,发现您可以使用宏来做到这一点。
Sub FindHighlight()
Dim tempCell As Range, Found As Range, sTxt, FoundRange, Response As Integer
Set Found = Range("A1")
sTxt = InputBox(prompt:="Enter value for search", Title:="VoG's Finder")
If sTxt = "" Then Exit Sub
Set tempCell = Cells.Find(what:=sTxt, After:=Found)
If tempCell Is Nothing Then
MsgBox prompt:="Not found", Title:="VoG's Finder"
Exit Sub
Else
Set Found = tempCell
Set FoundRange = Found
End If
Do
Set tempCell = Cells.FindNext(After:=Found)
If Found.Row >= tempCell.Row And Found.Column >= tempCell.Column Then Exit Do
Set Found = tempCell
Set FoundRange = Application.Union(FoundRange, Found)
Loop
FoundRange.Interior.ColorIndex = 6
Response = MsgBox(prompt:="Clear highlighting", Title:="VoG's Finder", Buttons:=vbOKCancel + vbQuestion)
If Response = vbOK Then FoundRange.Interior.ColorIndex = xlNone
End Sub
当宏运行时,它将突出显示找到的单元格并提供清除突出显示的选项。如果您想暂时保留突出显示,请单击“取消”。然后,要稍后清除格式,请运行相同的搜索并单击“确定”。
点击这里查看源代码。