+ Reply to Thread
Results 1 to 3 of 3

Transposing dictionary keys and items into one column

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

    Transposing dictionary keys and items into one column

    I am probably going the long way round but like using the dictionary class.

    I can add the keys and items in fine- the keys come from data in column A, while the items from the adjacent cells in column B.

    I am trying to transpose the keys and the items into one column so the result is:

    Column C
    Key
    Item
    Key
    Item

    etc etc

    My code currently is:

    Please Login or Register  to view this content.
    This seems to work for the first key and corresponding item but thereafter returns N/A# .

    I have also considered:

    Please Login or Register  to view this content.
    But the result is the same.

    Any ideas?

    Thanks
    Strud

  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: Transposing dictionary keys and items into one column

    I'm pretty sure you can't do this by transposing.

    Try looping through the dictionary and writing the key/item pairs down the column.

    Something like this.
    Please Login or Register  to view this content.
    PS Not sure I've got the order you want, if it's wrong just switch k and dic(k).
    If posting code please use code tags, see here.

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

    Re: Transposing dictionary keys and items into one column

    Brilliant thanks Norie that works 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. [SOLVED] Adding items to Dictionary object
    By Eduard in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2013, 04:39 AM
  3. [SOLVED] Scripting Dictionary add additional items
    By thisisgerald in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-15-2012, 07:32 AM
  4. Nested dictionary items, how do you access them?
    By treyr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2010, 12:23 PM
  5. looping through items in a dictionary
    By Abe in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-08-2006, 05:45 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