+ Reply to Thread
Results 1 to 10 of 10

Using Dictionary in VBA scripting

  1. #1
    Forum Contributor
    Join Date
    10-01-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    136

    Using Dictionary in VBA scripting

    Can someone help me with a reference or a link of a tutorial on how and when to understand the use of dictionaries in excel VBA scripting? I have seen lots of Excel Gurus use the dictionaries and I have tried to understand this methodology and when to use them.
    If possible to include a code with comments on each line so that I can understand the use of the dictionary.
    Examples of the dictionary scripting are as follows:

    CreateObject("System.Collections.SortedList")
    CreateObject("VBScript.RegExp")

    Or if you know of any Excel book that explained this in details, please let me know also.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Using Dictionary in VBA scripting

    Neither of those are for a Dictionary, the first is for a (sorted)list and the second a regular expression.

    This is how you would create a Dictionary object.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Using Dictionary in VBA scripting


    Hi,

    help on MSDN site …

  4. #4
    Forum Contributor
    Join Date
    10-01-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Using Dictionary in VBA scripting

    Thanks Norie, but do you have any reference that has lots of examples on the use of the dictionaries and also the ones below. I have seen lots of codes with these and I will like some explanations:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-01-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Using Dictionary in VBA scripting

    For example, below is one of the codes written in this forum by one of the Gurus.....can someone put a comment for me to explain each line of code in red. Thanks

    Please Login or Register  to view this content.
    Last edited by vnzerem; 01-03-2014 at 12:10 PM.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Using Dictionary in VBA scripting

    Sorted lists aren't really a VBA thing and I've only seen them implement a few times, here's a reference for it.

    Regular expressions is a pretty wide topic, if you want to find out more about the topic have a look at a tutorial like this.

    Here's a short tutorial on using the dictionary object in VBA.

  7. #7
    Forum Contributor
    Join Date
    10-01-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Using Dictionary in VBA scripting

    Norie, thanks for the references. I need to study them in details.

  8. #8
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Using Dictionary in VBA scripting

    Take a look at snb's site for info on Dictionaries (and many other things)..

    http://www.snb-vba.eu/VBA_Dictionary_en.html

  9. #9
    Forum Contributor
    Join Date
    10-01-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Using Dictionary in VBA scripting

    apo, thanks for the link. It will really help me a lot. I appreciate it so much

  10. #10
    Forum Contributor
    Join Date
    08-17-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Using Dictionary in VBA scripting

    Hi Apo,

    Could you please suggest me the same level of tutorial for VBA Array.

    Regards,
    BS Singh

+ 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. Scripting Dictionary
    By Tendla in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2013, 05:41 AM
  2. Object - Scripting.Dictionary
    By NeedForExcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2013, 06:00 AM
  3. Scripting.Dictionary Question
    By msolari in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-27-2013, 05:39 PM
  4. [SOLVED] Scripting Dictionary
    By thisisgerald in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-18-2012, 01:30 PM
  5. [SOLVED] Scripting Dictionary help
    By williams485 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-13-2012, 08:22 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