decadence
Well-known Member
- Joined
- Oct 9, 2015
- Messages
- 525
- Office Version
- 365
- 2016
- 2013
- 2010
- 2007
- Platform
- Windows
Hi, I am trying to highlight cells if part of the cell contains a number from an array, once finished looping through add a message box as a warning that the numbers from the array were found, Here is what I have so far but I can't seem to get it to work, Can someone help with this please
Code:
Dim x As range, MyArr As Variant, i As Long
MyArr = Array("101923", "114054", "115501", "117889", "122351", "122352", "125448", "125515", "125516", "125517", "126171", "129320", "129321", "129322", "147499", "157207", "159039", "181603", "190266", "198897", "251583", "262097", "300027", "302689", "304359", "341228")
For i = LBound(MyArr) To UBound(MyArr)
For Each x In ActiveSheet.UsedRange
If InStr(1, MyArr(i)) Then x.Interior.ColorIndex = 36
Next x
Next i
End Sub