+ Reply to Thread
Results 1 to 5 of 5

Why do nested dictionaries update retroactively?

  1. #1
    Registered User
    Join Date
    07-10-2013
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    77

    Why do nested dictionaries update retroactively?

    If you have a normal dictionary key and you set a variable equal to that key's definition and then change the value of that variable, the definition within the dictionary won't change unless you re-save it in the dictionary. However, as you can see by running the sub below, if you have a nested dictionary and change anything within it, you don't need to resave it in the original dictionary for the changes to take affect. Anything you add or change will still be reflected in the original dictionary. The only exception is when you set the dictionary equal to Nothing. In that case, the nested dictionary will still exist in the original dictionary. Is there a good explanation for this?

    Please Login or Register  to view this content.

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

    Re: Why do nested dictionaries update retroactively?

    dic1 & dic2 is a totally different instance of object.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-10-2013
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Why do nested dictionaries update retroactively?

    It's because they are different instances that I'm surprised dic1 definition of dic2 changes even without re-saving them


    Quote Originally Posted by jindon View Post
    dic1 & dic2 is a totally different instance of object.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-10-2013
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Why do nested dictionaries update retroactively?

    If we expected regular variables to do the same, this message box would display as 7 instead of 4

    Please Login or Register  to view this content.

    Quote Originally Posted by jindon View Post
    dic1 & dic2 is a totally different instance of object.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Why do nested dictionaries update retroactively?

    That's completely different. You're assigning a literal value to the dictionary element then assigning that value to a variable. There is no connection between the two thereafter.
    Remember what the dormouse said
    Feed your head

+ 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. Creating Dictionary of Dictionaries
    By Dodo123 in forum Excel Programming / VBA / Macros
    Replies: 32
    Last Post: 03-02-2014, 11:30 AM
  2. retroactively applying formulas to existing data
    By jacquelineb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-06-2013, 10:01 AM
  3. [SOLVED] Looking for online learning materials on arrays & scripting dictionaries
    By strud in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-11-2013, 08:16 AM
  4. Multiple Dictionaries Or One Dictionary
    By goss in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-15-2012, 07:58 AM
  5. UPDATE ISNUMBER and nested FINDs not working as expected
    By johnmerlino in forum Excel General
    Replies: 4
    Last Post: 11-10-2010, 02:13 AM
  6. Retroactively calculating fees in one formula.
    By MCCCLXXXV in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-29-2009, 10:57 PM
  7. Creating find and replace dictionaries
    By SlipperyPete in forum Excel General
    Replies: 1
    Last Post: 12-15-2006, 11:54 AM
  8. Dictionaries for grouping
    By Piotr in forum Excel General
    Replies: 2
    Last Post: 05-23-2005, 07:06 AM

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