+ Reply to Thread
Results 1 to 5 of 5

Macro to list variant items of a barcode

  1. #1
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Macro to list variant items of a barcode

    Hello all,

    I am looking for a way to streamline my excel workbook. I use certain items which fall under the same barcode and wish to be able to assign variant ID's to them.

    For instance, I may have several items that differ by colour under the same actual barcode so I use another column called "Variant" and in that i write "red", "blue" etc.

    I then recall the information to alter the state of that particular stock. I do this by scanning the barcode into col B, then using an array formula to get the variant names in Col D. Using a data validation dropdown I can then choose the variant that I want to work with. This works well but the problem is that my worksheet has to be able to look at 50+ items at a time, and having 50+ array formulas on a sheet is going to be extremely memory-hungry.

    If a better answer exists, I am happy to look into it but I am wanting to turn the following array formula into a macro that can be activated when I have finished entering all of the barcodes and wish to list the variants for my validation list...

    Please Login or Register  to view this content.
    The code might be familiar to more advanced users, for each of the rows in my barcode worksheet, there are 10 of these formulas that will list up to 10 seperate variant ID's per barcode (so for a list of 50 barcodes, there are 500 array formulas using up processing power!).

    I think that the best solution to my problem is to simply make a macro that:
    • Looks at the barcode, if there is one present in B8
    • Finds and lists all of the Variant ID's (@Transactions!$D:$D), where b8 matches Transactions!$B$3:$B$23000
    • Moves to the next barcode present in col B
    • until it finds a blank cell.


    I'd like the list for each barcode to be placed after col HV but as long as i can select the range for use in a data validation list i am not strict with how the data is presented.

    Many thanks in advance, I hope I have described the original problem, and my suggested solution clearly. I can elaborate if needed.

    - Dom
    IF("helping me", "thanks", "need more detail?")

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Macro to list variant items of a barcode

    For clarity and consistency it's better to name all your worksheets in the code, but I didn't see a worksheet name for your barcodes. You'll need to plug in that sheet name in the first line of code where I have "Barcodes", otherwise this code won't work.

    Please Login or Register  to view this content.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Macro to list variant items of a barcode

    Hello and thank you for your reply.

    The macro is running fine with only 1 or two snags. First is minor, in that the name you gave the sub made for some interesting behavior (in that selecting "macros" would select the cell JH86 and not allow for me to actually run the macro lol. An easy fix

    The second is that the resulting list is printed in just one cell, with carriage returns between each entry. Can you make your code output each list item to a separate line (HV8:HV18)? - There will never be more than 10 different variant names so 10 rows is more than adequate.

    I appreciate your help (and hope you find employment opportunities for your VBA skills soon!)

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Macro to list variant items of a barcode

    I think this is what you want? Again, change the barcode sheet name.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Macro to list variant items of a barcode

    That code works okay, thank you. However if there is more than one barcode listed on col B, it loops through and lists all possible variants on column HV.

    Is there a way to loop through ten times (to give me the 10 rows of variant ID's, and then move to the next barcode and print the results 1 column over (HW ++)?

    I appreciate your time, and simply by contrasting the two pieces of code you have given so far I have learnt a lot
    Last edited by jayherring86; 01-18-2016 at 06:23 PM.

+ 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] How to apply macro to list of items
    By Jess0121 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-16-2015, 02:59 PM
  2. use my barcode scanner to add or subtract and find items in my spreadsheet
    By flaflash64 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-20-2015, 03:40 PM
  3. Need help for macro to list and sort items
    By elguapo195 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2013, 04:55 PM
  4. [SOLVED] Pick out some items in a list and paste them on another with a macro
    By pfereday in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-11-2012, 05:02 PM
  5. Replies: 1
    Last Post: 12-18-2011, 12:32 PM
  6. Macro to list out items with conditions
    By Saky in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2011, 10:26 AM
  7. Macro for adding new items to list
    By SanctifiedRock in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2006, 02:02 PM

Tags for this Thread

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