实现高亮效果如下:

代码如下:
(所在工作表是工作簿的第二个表,所以ThisWorkBook.Sheets(2),括号里面的是2,也可以是表 名“练习题002”)
Sub 高亮特定内容所在的行()
Dim ws As Worksheet
Dim lastRow As Long, lastCol As Long
Dim keyword As String
Dim i As Long, j As Long
' 设置工作表
Set ws = ThisWorkbook.Sheets(2) ' 修改为你的工作表名称
keyword = "华北" ' 要查找的关键字
' 获取最后一行
lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
' 获取最后一列
lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column
' 遍历所有单元格,查找包含关键字"华北"的行
For i = 2 To lastRow ' 从第2行开始遍历(跳过标题行)
For j = 2 To lastCol ' 遍历从第2列到最后一列(从项目1到项目5)
If ws.Cells(i, j).Value Like "*" & keyword & "*" Then
' 如果找到关键字"华北",则高亮整行从列1到最后一列
ws.Range(ws.Cells(i, 1), ws.Cells(i, lastCol)).Interior.Color = vbYellow
Exit For ' 只要找到一处关键字就可以跳出当前行的循环
End If
Next j
Next i
End Sub
在高亮的基础上实现筛选(就是将其余没有高亮的部分进行隐藏)的效果如下:

添加之后的代码如下:

Sub 筛选()
Dim ws As Worksheet
Dim lastRow As Long, lastCol As Long
Dim keyword As String
Dim i As Long, j As Long
Dim found As Boolean
' 设置工作表
Set ws = ThisWorkbook.Sheets(2) ' 修改为你的工作表名称
keyword = "华北" ' 要查找的关键字
' 获取最后一行
lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
' 获取最后一列
lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column
' 遍历所有单元格,查找包含关键字"华北"的行
For i = 2 To lastRow ' 从第2行开始遍历(跳过标题行)
found = False
For j = 2 To lastCol ' 遍历从第2列到最后一列(从项目1到项目5)
If ws.Cells(i, j).Value Like "*" & keyword & "*" Then
' 如果找到关键字"华北",则高亮整行从列1到最后一列
ws.Range(ws.Cells(i, 1), ws.Cells(i, lastCol)).Interior.Color = vbYellow
found = True
Exit For ' 只要找到一处关键字就可以跳出当前行的循环
End If
Next j
If Not found Then
ws.Rows(i).Hidden = True
End If
Next i
End Sub