+ Reply to Thread
Results 1 to 6 of 6

Referencing multiple dic.items in dictionary to clean up my code

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

    Referencing multiple dic.items in dictionary to clean up my code

    I am currently using two dictionaries in one code, which works, but was wandering whether the code could be cleaned up so as to execute the same series of events using only one dictionary. I prefer to keep codes to a minimum if I can.

    Essentially, the code checks one sheet for a product code. It then 'copies' the product code and data from two specific columns in the same row. If there are multiple of the same product code it will accumulate the data in the other two columns the 'end product' is just one row with the product code and accumulated totals adjacent.

    Here is the code....what I am trying to do would be combine dic and dic2, but I cannot work out how...

    Please Login or Register  to view this content.

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Referencing multiple dic.items in dictionary to clean up my code

    Hi Strud
    can you upload an example workbook

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

    Re: Referencing multiple dic.items in dictionary to clean up my code

    Sure...here you go..

    I have omitted irrelevant data so ignore blank columns
    Attached Files Attached Files

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Referencing multiple dic.items in dictionary to clean up my code

    Perhaps this:-
    Please Login or Register  to view this content.
    Regards Mick

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

    Re: Referencing multiple dic.items in dictionary to clean up my code

    Brilliant Mick that's perfect!!

    I can see how you've referenced both items for one key:

    Please Login or Register  to view this content.
    So I'm with you.

    Thanks for your help...was curiosity really but I think it's good practice to try to keep codes as clean as possible.

    Thanks again

  6. #6
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Referencing multiple dic.items in dictionary to clean up my code

    Your welcome
    Regrds Mick

+ 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] Add multiple items to scripting dictionary from one key and keep structure
    By strud in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-07-2013, 09:44 AM
  2. Referencing Multiple Items from Pivot Field in macro
    By dgeisman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-07-2012, 01:01 PM
  3. [SOLVED] VBA Code to optimize and clean data- clean out numerical/ or symbol
    By tracylsr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2012, 04:21 PM
  4. Referencing multiple items
    By msbaath in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-02-2008, 03:52 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