Hi
I would like to add a list of items to a dictionary and then loop each item. The problem is, I don't know how to refer to a list range that is on another worksheet than the main data that is being filtered. "Items" are located on sheet wsList, so where am I suppose to add it?
Dim dict As Object, Items As Variant, c As Long, item As Variant
Set dict = CreateObject("Scripting.Dictionary")
With wsData
Dim ui As Double
If Range("D3").Value <> "" Then
ui = 2
Items = Range(.Range("A2"), .Cells(Rows.Count, "A").End(xlUp)) --> Items = Range(wsList.Range("A2"), .Cells(Rows.Count, "A").End(xlUp))doesn't work
For c = 1 To UBound(Items, 1)
dict(Items(c, 1)) = 1
Next
Else
item = Range("A2").Value --> same problem
ui = 1
End If
End with
The above is just a small part of my code, please let me know if you need to see more of it.
Many thanks!
I would like to add a list of items to a dictionary and then loop each item. The problem is, I don't know how to refer to a list range that is on another worksheet than the main data that is being filtered. "Items" are located on sheet wsList, so where am I suppose to add it?
Dim dict As Object, Items As Variant, c As Long, item As Variant
Set dict = CreateObject("Scripting.Dictionary")
With wsData
Dim ui As Double
If Range("D3").Value <> "" Then
ui = 2
Items = Range(.Range("A2"), .Cells(Rows.Count, "A").End(xlUp)) --> Items = Range(wsList.Range("A2"), .Cells(Rows.Count, "A").End(xlUp))doesn't work
For c = 1 To UBound(Items, 1)
dict(Items(c, 1)) = 1
Next
Else
item = Range("A2").Value --> same problem
ui = 1
End If
End with
The above is just a small part of my code, please let me know if you need to see more of it.
Many thanks!