Results 1 to 14 of 14

Run-time error 6: Overflow - Trying to generate list of combinations

Threaded View

AdamParker Run-time error 6: Overflow -... 05-21-2013, 06:05 PM
shg Re: Run-time error 6:... 05-21-2013, 06:14 PM
AdamParker Re: Run-time error 6:... 05-21-2013, 07:26 PM
shg Re: Run-time error 6:... 05-21-2013, 07:39 PM
Ed_Collins Re: Run-time error 6:... 05-21-2013, 07:52 PM
kalak Re: Run-time error 6:... 05-21-2013, 09:24 PM
Ed_Collins Re: Run-time error 6:... 05-21-2013, 09:57 PM
Ed_Collins Re: Run-time error 6:... 05-21-2013, 07:47 PM
Ed_Collins Re: Run-time error 6:... 05-21-2013, 09:36 PM
Ed_Collins Re: Run-time error 6:... 05-21-2013, 10:51 PM
kalak Re: Run-time error 6:... 05-22-2013, 12:22 AM
Ed_Collins Re: Run-time error 6:... 05-22-2013, 12:26 AM
AdamParker Re: Run-time error 6:... 05-22-2013, 09:27 AM
Ed_Collins Re: Run-time error 6:... 05-22-2013, 10:54 AM
  1. #1
    Registered User
    Join Date
    04-24-2008
    Posts
    85

    Run-time error 6: Overflow - Trying to generate list of combinations

    Hello, I'm running into a problem and am wondering if there's an easy way to get around this.
    I have three columns of information and I'm trying to get every possible combination. This works when the lists are small, however when I use my actual data - I get an overflow error.
    These are the lengths of my list:
    Column1 = 6
    Column2 = 90
    Column3 = 389

    This is my code:
    Sub Generate_Summary()
    Dim rng1 As Range, rng2 As Range, rng3 As Range
    Dim cell1 As Range, cell2 As Range, cell3 As Range
    Dim i As Integer
    i = 2
    
    Set rng1 = Range("Column1")
    Set rng2 = Range("Column2")
    Set rng3 = Range("Column3")
    
    For Each cell1 In rng1
    For Each cell2 In rng2
    For Each cell3 In rng3
    
    Cells(i, 1) = cell1
    Cells(i, 2) = cell2
    Cells(i, 3) = cell3
    i = i + 1
    Next cell3
    Next cell2
    Next cell1
    End Sub
    Is there any easy way around this?
    I get this error after it generates about 32,767 rows..

    Column2 is also dependant on Column1... ie: if Column1 value was A, column2 selection can be reduced to a much smaller amount -- this could potentially help, but I'm unsure of how to code this in - I adapted this code that I'm using from doing some google searching and extensive trial & error.

    Thanks for any suggestions.
    Adam
    Last edited by AdamParker; 05-22-2013 at 09:27 AM. Reason: Solved

Thread Information

Users Browsing this Thread

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

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