+ Reply to Thread
Results 1 to 9 of 9

Adding dictionary into dictionary and retrieving data

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Adding dictionary into dictionary and retrieving data

    Hi,

    i am adding dictionary as keys and ranges as items into dictionary.

    Please Login or Register  to view this content.
    How to add keys and items into dic2 and dic3 in function above?

    And how to retrieve them?
    I want to take each of key later and use .exits method for dic2 and dic3 .

    Please help,
    Best,
    Jacek
    Attached Files Attached Files

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Adding dictionary into dictionary and retrieving data

    I'm not sure why you'd use a Dictionary as a key rather than an item, but:

    Please Login or Register  to view this content.
    Rory

  3. #3
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Adding dictionary into dictionary and retrieving data

    As a separate note, writing this:

    Please Login or Register  to view this content.
    declares r1 as a Variant, not a Range. You have to specify the type for each variable.

    And there's not much point to a Function that doesn't return anything.

  4. #4
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Adding dictionary into dictionary and retrieving data

    Yes,

    thank you rorya.

    what be the syntax for retrieving key from dic2 ?

    Please Login or Register  to view this content.
    This is awesome, but i can not find key for dic2 for key(1) for dic.

    I want to retrieve (after function in msgbox):
    1) key from dic2 for dic - first key,

    ---->


    declares r1 as a Variant, not a Range
    Why my friend? I do not understand.

    Best,
    Jacek
    Last edited by jaryszek; 10-08-2018 at 06:17 AM.

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Adding dictionary into dictionary and retrieving data

    Quote Originally Posted by jaryszek View Post
    what be the syntax for retrieving key from dic2 ?

    Please Login or Register  to view this content.
    Use .keys not .items

    Why my friend? I do not understand.
    I just told you why - you have to specify the type for each variable. If you don't, you get the default type, which is Variant.

  6. #6
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Adding dictionary into dictionary and retrieving data

    Thank you rorya.

    Hmm,
    so i created ranges and add it to dictionary. I set up variables.
    Ranges where changed into Variant?

    Best,
    Jacek

  7. #7
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,256
    Quote Originally Posted by jaryszek View Post
    Hi,

    i am adding dictionary as keys and ranges as items into dictionary.

    Please Login or Register  to view this content.
    How to add keys and items into dic2 and dic3 in function above?

    And how to retrieve them?
    I want to take each of key later and use .exits method for dic2 and dic3 .

    Please help,
    Best,
    Jacek
    Maybe you using parent and child dict
    Maybe like this but not sure what you want
    Please Login or Register  to view this content.
    "ThankyouFor Attention * And Your Help!!"

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Adding dictionary into dictionary and retrieving data

    Quote Originally Posted by jaryszek View Post
    I set up variables.
    Ranges where changed into Variant?
    Where you declared them. This:

    Please Login or Register  to view this content.
    does not declare r1 as a Range and r2 as a Range. It is actually the same as:

    Please Login or Register  to view this content.
    To make them both Range objects, you must use:

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Adding dictionary into dictionary and retrieving data

    thank you rorya, daboho.

    It is understanding. I implemented rorya code.

    Best,
    Jacek

+ 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. Retrieving values from dictionary
    By badeye in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-30-2016, 05:45 AM
  2. [SOLVED] Dictionary or Scripting.Dictionary. Binding Referencing Dim-ing. Sub routines and Function
    By Doc.AElstein in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-12-2016, 08:28 AM
  3. [SOLVED] How to compare keys in one dictionary to keys in another dictionary
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-15-2015, 02:27 PM
  4. Storing a Dictionary into a Dictionary Object
    By pago_boss in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2015, 03:04 AM
  5. Dictionary - Using a dictionary of dictionaries to hold individual orders
    By wazimu13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-09-2015, 08:32 PM
  6. [SOLVED] Problems retrieving keys as well as items when using scripting dictionary
    By strud in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-09-2013, 05:31 AM
  7. [SOLVED] Adding items to Dictionary object
    By Eduard in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2013, 04:39 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