Closed Thread
Results 1 to 4 of 4

expand list of values with vba

  1. #1
    Registered User
    Join Date
    03-01-2013
    Location
    Romānia
    MS-Off Ver
    Excel 2007
    Posts
    22

    expand list of values with vba

    Hi,

    i am pretty new with VBA and i would like some assistance to expand the below format with VBA in another sheet:

    rep A industry A country A
    rep A Industry B country B
    rep A Industry C country c


    to:

    rep A industry A country A
    rep A industry B country A
    rep A industry C country A
    rep A industry A country B
    rep A industry B country B
    rep A industry C country B
    rep A industry A country C
    rep A industry B country C
    rep A industry C country C

    so for each country the rep A needs to cover all industries in column B

    let me know if more details are required.

    Kind regards,
    Dumitru

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: expand list of values with vba

    Try this:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-01-2013
    Location
    Romānia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: expand list of values with vba

    works almost ok

    the result is not including Rep A (and i would like to have too in sheet 2) it only shows the Industry A for country A B C (which is what i was looking for)
    However i noticed something in my file:
    for Rep A i have has more industries than countries:

    rep A industry A country A
    rep A Industry B country B
    rep A Industry C country c
    rep A Industry D
    rep A Industry E

    and for this case the result should be like:

    rep A industry A country A
    rep A industry B country A
    rep A industry C country A
    rep A industry D country A
    rep A industry E country A
    rep A industry A country B
    rep A industry B country B
    rep A industry C country B
    rep A industry D country B
    rep A industry E country B
    rep A industry A country C
    rep A industry B country C
    rep A industry C country C
    rep A industry D country C
    rep A industry E country C



    This the situation also for the reps following.

    One other thing i noticed is that this code does not "stop" for one rep and it took the list of countries from the other reps until the end of the sheet:

    from
    rep A industry A country A
    rep A Industry B country B
    rep A Industry C country c
    rep B Industry x country z
    rep b industry y country q


    to

    rep A industry A country A
    rep A industry A country B
    rep A industry A country C
    rep A industry A country D
    rep A industry A country E
    rep A Industry A country Z
    rep A industry A country Q
    which should not happen

    Thanks for the prompt reply.

    Kind regards,
    Dumitru

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: expand list of values with vba

    Thread posted in Commercial Services, hence closed.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to expand a drop down list .
    By Onesock in forum Excel General
    Replies: 2
    Last Post: 02-20-2013, 05:31 PM
  2. [SOLVED] Need to take a list of names and expand them so the list shows the same name 5 times...
    By 1OneSeven7 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-24-2012, 01:33 PM
  3. Duplicate and expand a list of values
    By aaherrera in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 09-07-2010, 03:40 PM
  4. Expand out a dropdown list?
    By leaning in forum Excel General
    Replies: 2
    Last Post: 08-24-2010, 10:30 PM
  5. Expand or delete list frame
    By kcparker in forum Excel General
    Replies: 2
    Last Post: 11-11-2009, 01:34 PM

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