got this code:
Dim a, i As Long
With Range("K1", Range("K" & Rows.Count).End(xlUp))
a = .Value
End With
With CreateObject("Scripting.Dictionary")
.CompareMode = vbTextCompare
.Add "test", 1
For i = 1 To UBound(a, 1)
If .exists(a(i, 1)) Then
Cells(i, 14).Value = 1
Else
Cells(i, 14).Value = 0
End If
Next
End With
It perfectly will give me a "1" in column 14 when the word "test" is anywhere in column K.
If I change the ".Add "test", 1" line to ".Add "21", 1" it only returns "0" although I have "21" in column K.
On the net is says that .key values can be any value(text, numbers, etc). As column K only contains numbers(1 to 25) I need the script to mark occurrences of 1 of those numbers and I really want to use "scripting.dictionary" as it is the fastest way.
What am I doing wrong or doesn't "scripting.dictionary" support numbers only.