+ Reply to Thread
Results 1 to 3 of 3

Is a ScriptingDictionary like a named range in that it persists

  1. #1
    Forum Contributor
    Join Date
    02-01-2021
    Location
    Manchester
    MS-Off Ver
    365
    Posts
    216

    Is a ScriptingDictionary like a named range in that it persists

    I am using this code ;-
    Please Login or Register  to view this content.
    To find items in one range that are not in another.
    It works fine on the first time of use but on the second gives an error
    "This key is already associated with an element of this collection" at the line CodeList.Add Val, I

    Using Scripting.Dictionary is such a neat way of getting a list of missing items that I want to hold on to it.
    The error message hints that I should get rid of it at the end of this sub so the code creates it fresh again.
    Or have I misunderstood what Scripting.Dictionary means.
    John

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Is a ScriptingDictionary like a named range in that it persists

    You can only add UNIQUE value to the key, so when you try to add the key that is already exist, it throw the error.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    02-01-2021
    Location
    Manchester
    MS-Off Ver
    365
    Posts
    216

    Re: Is a ScriptingDictionary like a named range in that it persists

    jindon
    Many thanks for your help. I have been able to solve my problem now
    John

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Countif with ADO or ScriptingDictionary
    By turist in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 12-22-2018, 10:08 PM
  2. Listbox displaying named range B but Adding named range A to cell
    By ikkenieikke in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-05-2018, 02:27 PM
  3. [SOLVED] Compare cells to named range and create new sheets using related named range
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-10-2015, 03:35 PM
  4. Userform text box persists in writing US date format to worksheet
    By Aestivator1 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-04-2015, 03:45 PM
  5. [SOLVED] Determine what Named Range the Target Address is and return Named Range Name
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-18-2012, 10:49 PM
  6. Lotus Formatting Persists in Excel
    By BazzaBoy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-12-2009, 04:07 PM
  7. [SOLVED] macro warning persists even after deleting all macros
    By Todd in forum Excel General
    Replies: 3
    Last Post: 07-25-2005, 06:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1