如何用特定短语强调行? [英] how do I highlight rows with a certain phrase?
本文介绍了如何用特定短语强调行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的工作地点是Excel电子表格中列出的每月号码。每个月,我的同事都必须找到每一行都有短语 Jacobs Eng QP
,并手动突出显示该行。是否有一个可以为我做的这个宏?
解决方案
选择范围
然后等于
并在输入框中输入 Jacobs Eng QP 。
VBA用户友好的解决方案
Option Explicit
Sub HighlightCells()
Dim rangeToCheck As Range
设置rangeToCheck =应用程序.InputBox(Prompt:=请选择范围,标题:=范围选择,类型:= 8)
Dim searchTerm As String
searchTerm = InputBox(Enter search term )
Dim cell As Range
对于每个单元格在rangeToCheck
如果InStr(1,单元格,searchTerm,vbTextCompare)然后cel l.Interior.Color = RGB(255,0,0)
下一个
End Sub
其他资源:
The place I work for has monthly numbers listed in an Excel spreadsheet. Every month my coworker has to find every row with the phrase Jacobs Eng QP
and highlight the row manually. Is there a macro that could do this for me?
解决方案
Select range
Click Conditional Formatting
in the ribbon.
then Equal to
and type Jacobs Eng QP in the input box.
VBA user-friendly solution
Option Explicit
Sub HighlightCells()
Dim rangeToCheck As Range
Set rangeToCheck = Application.InputBox(Prompt:="Please Select Range", Title:="Range Select", Type:=8)
Dim searchTerm As String
searchTerm = InputBox("Enter search term")
Dim cell As Range
For Each cell In rangeToCheck
If InStr(1, cell, searchTerm, vbTextCompare) Then cell.Interior.Color = RGB(255, 0, 0)
Next
End Sub
Additional resource:
这篇关于如何用特定短语强调行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文