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
Bookmarks