+ Reply to Thread
Results 1 to 2 of 2

Need to decipher/understand this function

  1. #1
    Registered User
    Join Date
    06-13-2016
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    95

    Need to decipher/understand this function

    Hi all,

    The one thing in VBA i havent quite learned yet is arrays/dictionaries.

    Unfortunately trying to debug a macro that is built entirely through dictionary mappings and arrays. Was wondering if someone could help me understand what is happening in the following function?

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Need to decipher/understand this function

    It looks like array1 and array2 are horizontal ranges (i.e., contiguous cells in the same row). In a Dictionary, each entry has a unique key, which can be any data type, and a value. In the loop it is using the values in array1 as the keys and corresponding values in array2 as the values.

    The tricky part here is that because the keys are unique, if array1 has any duplicate values, only the rightmost value in array2 corresponding to the duplicates in array1 is going to stick in the dictionary. I would guess that is the whole reason for using the dictionary here in the first place, to remove duplicates.

    (This code assumes that array2 is at least as long as array1. If that is not true there will be a run-time error.)
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. Replies: 2
    Last Post: 08-04-2014, 03:12 AM
  2. How to decipher what vehicle has been used on what day
    By Nicky_B in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-26-2014, 10:43 AM
  3. Can someone decipher this formula for me?
    By lifeboat in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-22-2014, 12:11 PM
  4. Help decipher this formula, please
    By IndyDomer in forum Excel General
    Replies: 1
    Last Post: 06-27-2012, 07:00 PM
  5. Don't seem to understand QUOTIENT function
    By avhfj in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-29-2010, 12:01 PM
  6. Replies: 1
    Last Post: 09-18-2007, 02:07 PM
  7. Don't understand Lookup function
    By Beblessed in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-01-2006, 04:57 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