+ Reply to Thread
Results 1 to 8 of 8

Add multiple items to scripting dictionary from one key and keep structure

  1. #1
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Add multiple items to scripting dictionary from one key and keep structure

    I have been using a scripting dictionary to extract values in column B based on whether the value in column matches a certain criteria.

    I would now like to extract the value in column C as well as B (if A matches vCriteria) and then paste in the same format- currently it transposes into a one-column list- I need to column B & C values to stay adjacent.

    here's the current code:

    Please Login or Register  to view this content.
    thanks guys

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Add multiple items to scripting dictionary from one key and keep structure

    strud,
    You post part of the code and this code compares column B, not A.
    It could easily be resolved if you could attach the sample you used with the above code, and your desired result.

  3. #3
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Add multiple items to scripting dictionary from one key and keep structure

    No it compares column A to my vCriteria then adds the value in column B if there is a match.

    It doesn't really seem necessary to add a sample workbook I'm just having trouble adding column C as well (if there is a match).

    I have changed it to the following- but this produces an error:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Add multiple items to scripting dictionary from one key and keep structure

    How do I test it then if I can not see the sample?
    This will remove the error you are getting, but I doubt if the you get the result.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Add multiple items to scripting dictionary from one key and keep structure

    Ah I didn't realise you would need to test it- sorry about that.

    here's an example workbook...
    Attached Files Attached Files

  6. #6
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Add multiple items to scripting dictionary from one key and keep structure

    You can use:
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Add multiple items to scripting dictionary from one key and keep structure

    Try the attached.
    Please note there is a space on G1.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Add multiple items to scripting dictionary from one key and keep structure

    thanks guys both solutions work perfectly

+ 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] 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
  2. Create array with distinct items using scripting.dictionary
    By icyrius in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-06-2013, 04:36 PM
  3. [SOLVED] Scripting Dictionary
    By thisisgerald in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-18-2012, 01:30 PM
  4. [SOLVED] Scripting Dictionary help
    By williams485 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-13-2012, 08:22 AM
  5. [SOLVED] Scripting Dictionary add additional items
    By thisisgerald in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-15-2012, 07:32 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