![在 Excel 中搜索多个值并突出显示它们](https://linux22.com/image/1469913/%E5%9C%A8%20Excel%20%E4%B8%AD%E6%90%9C%E7%B4%A2%E5%A4%9A%E4%B8%AA%E5%80%BC%E5%B9%B6%E7%AA%81%E5%87%BA%E6%98%BE%E7%A4%BA%E5%AE%83%E4%BB%AC.png)
我需要从 650 个数字的列表中搜索 105 个数字,如果找到则突出显示它们。有没有更简单的方法可以做到这一点?例如。exceel 中的 x 列有 10 个值,我需要在 x 列中搜索 5 个值并突出显示它。(当然实际数字更大)
答案1
如果你有简短的清单A以及列中的长列表乙喜欢:
运行此宏:
Sub dural()
Dim nA As Long, nB As Long, v As Variant
Dim a As Long, b As Long
nA = Cells(Rows.Count, "A").End(xlUp).Row
nB = Cells(Rows.Count, "B").End(xlUp).Row
For a = 1 To nA
v = Cells(a, "A").Value
For b = 1 To nB
If Cells(b, "B").Value = v Then
Cells(b, "B").Interior.ColorIndex = 6
End If
Next b
Next a
End Sub
将产生: