
我需要從 650 個號碼的清單中搜尋 105 個號碼,如果找到則突出顯示它們。有沒有更簡單的方法來做到這一點?例如。 excel中的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
將產生: