if item exists in array of scripting dictionary

tomleitch

Board Regular
Joined
Jan 3, 2012
Messages
189
Hi all,

I have some code that makes a scripting dictionary but I'm having a bit of a problem with trying to get it to do what I want.

Here's my code that's throwing up an error:

VBA Code:
   With CreateObject("scripting.dictionary")
  
 Set ws2 = Sheets("UPDATE TOOL3")
  
   For Each cl In ws2.Range("A2", ws2.Range("A" & Rows.Count).End(xlUp))
        
        If Not .exists(cl.Value) Then
                .Add cl.Value, Array(cl.Offset(, 1).Value, cl.Offset(, 2).Value, cl.Offset(, 3).Value)
                
                
           End If
          
          
            Next cl
 
                Set ws1 = Sheets("MAINT")


                For Each cl2 In ws1.Range("A10", ws1.Range("A" & Rows.Count).End(xlUp))
                
                If .exists.Item(cl.Value)(0)) Then
                
                etc...........

It's this bit that is giving me the trouble " If .exists.Item(cl.Value)(0)) Then"


Any help much appreciated,

Thanks
Tom
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,222,613
Messages
6,167,060
Members
452,093
Latest member
JamesFromAustin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top