+ Reply to Thread
Results 1 to 13 of 13

number combo generator?

Hybrid View

  1. #1
    Registered User
    Join Date
    01-20-2004
    Location
    Western NY
    Posts
    99
    I am happy that the code is close to what you want. Writing the "results" to another worksheet is simple, but before we do that, let's get the basics working correctly

    The other restriction needs clarification. In you original post, you had the same number in multiple columns. For example, "1" was in col 1, col 2 and col 3. If your restriction states that only one number can be drawn from each column, can the number replicated in multiple columns be used multiple times? Should your "rule" be restated as " ... no number can be equal or less than a number to the left ..." ?

    This new restriction does change how things are handled, but tweaking the code to do this should not be too difficult.

    What is the likely # of values per column? The exact number is not important, but the code might be different if the # were 100 vs 5. Similarly, how many columns are typical? Again, the exact number is not important.

    Finally, re "sending me something": this forum is set up to help people. It is expected that as users become more experienced and skilled, they will be able to help others. So, do not just seek help; log on now an again and see if there is someone you can help.

  2. #2
    Registered User
    Join Date
    04-23-2005
    Posts
    9
    Sorry about the unclear specs before. This is the first time I have had to actually try to explain these type of directions to anyone.

    Sometimes there will be duplicate numbers in each column. There cannot be any duplicate numbers per possible combination. No number will be equal to or less than the number to the left.

    Secondly, I'm expecting to use numbers in all five columns. Any combinations found using less than five columns aren't allowed. Also, I anticipate up to six or seven numbers in column one. upto fifteen numbers in columns two thru five.

    This means I am expecting some possible over flow of combinations onto a second worksheet (hopefully not a third).

    Again thankyou very much.

    P.S. Are there any good resources for beginners that I can get my hands on to read and teach my self VB. I'm sure this sight if full of useful informationk, I just haven't had time to look thru it all.

  3. #3
    Registered User
    Join Date
    01-20-2004
    Location
    Western NY
    Posts
    99
    I will tweak the code and post something back that will accomplish what you want.

    Some thought re "learning VB":
    1. explore what is available at this site and others. The ExcelForum has some good sources, poke around. Also, there is a focum focused on VBA only; they have an area just for learning VBA http://www.vbaexpress.com/forum/forumdisplay.php?f=6
    you should poke around there
    2. get a book on VBA that is aligned with what you want to accomplish. If you have done programming in other languages, a "programmer's reference" will be quite helpful. I like "VisualBasic Programmer's Reference" by Dan Rahmel. If you want something that is focused on Excel, I recommend John Walkenbach's "Excel2000 Power Programming with VBA"
    3. use the macro recorder to see the code generated by the application for things you want to do. The code is often bloated, but will give you an excellent feel for structure, methods, objects, properties, etc. Virtually every VBA programmer still uses the macro recorder to explore stuff and jog memories.
    4. there are many training courses, video courses, etc., available. This site and the VBA-X site can get your started.
    5. programming in VBA (like any other language) requires practice and experience.

  4. #4
    Registered User
    Join Date
    01-20-2004
    Location
    Western NY
    Posts
    99
    attached is a revised version of the code to handle the situation as you redefined it. The code is written to handle only 5 columns but does not care how many numbers are in each column. Given the very large number of combinations possible, the procedure no longer displays individual combinations. Rather it simply writes them to other worksheets. The code is presently set up to write up to 15000 combinations to each of 5 worksheets (the upper limit for rows in a worksheet is 65000). The combinations are written to "Combo" worksheets as a sequence of 5 numbers, each number in an individual cell.

    Let me know if this works.

    MWE
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-23-2005
    Posts
    9
    It couldn't be more perfect. I can't tell you how much you helped me out.

    Thank you very much,

    yungexec

  6. #6
    Registered User
    Join Date
    01-20-2004
    Location
    Western NY
    Posts
    99
    Glad to help out

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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