+ Reply to Thread
Results 1 to 5 of 5

read array of values to generate a list of combinations

  1. #1
    Registered User
    Join Date
    03-13-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    9

    read array of values to generate a list of combinations

    Hello,

    I am trying to use this code to generate a list of combinations. As highlighted in first red, this code takes the input values separated by commas and I need to type manually. If I want to read these values which are in a Sheet1 in Range("A1:G1"). How do I modify? Also, as highlighted in the second red, the results of each combination is listed in each cell separated by commas. How do I modify the code so that each value of a combination is listed in separate cells in a row. Thanks for your help.



    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: read array of values to generate a list of combinations

    vElements() = range("a1:g1")

    instead of this

    Join(vResult, ",")


    do a similar loop to the one on elements, but on return, putting each value in a cell,

    so say cells(iRowCounter,1).offset(0,iArrayCounter).vlaue = vresult(iArrayCounter)
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    03-13-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: read array of values to generate a list of combinations

    I am sorry that I could not understand the second part. Can you elaborate a bit more? Thanks.

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: read array of values to generate a list of combinations

    Please Login or Register  to view this content.
    Have a look (F1) at Offset.

  5. #5
    Registered User
    Join Date
    03-13-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: read array of values to generate a list of combinations

    Thanks.

    I understood the offset part. Just the loop part was a bit confusing. I tried to implement what you just said but am getting an error. I guess am making a mistake in the loop.

+ 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. List of 15 elements, need to generate all 6 element combinations.
    By j4c0b5m17h in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-22-2013, 02:11 PM
  2. [SOLVED] Run-time error 6: Overflow - Trying to generate list of combinations
    By AdamParker in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-22-2013, 10:54 AM
  3. Generate list of possible combinations
    By Pat Parker in forum Excel General
    Replies: 2
    Last Post: 03-14-2010, 03:34 PM
  4. Trying to generate a table of unique values from an array...
    By djsquare in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-21-2007, 11:41 AM
  5. Need combinations of values from a list to add up to a specific Va
    By GUY in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 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