I'm using the following VBA script I discovered online, however, the permutations cease at S/N 1048576. I have 5 columns worth of data: 3 rows, 40 rows, 40 rows, 40 rows, and 6 rows, respectively.
Sub ListAllCombinations()
Dim xDRg1, xDRg2, xDRg3, xDRg4, xDRg5 As Range
Dim xRg As Range
Dim xStr As String
Dim xFN1, xFN2, xFN3, xFN4, xFN5 As Integer
Dim xSV1, xSV2, xSV3, xSV4, xSV5 As String
Set xDRg1 = Range("A2:A4") 'First column data
Set xDRg2 = Range("B2:B41") 'Second column data
Set xDRg3 = Range("C2:C41") 'Third column data
Set xDRg4 = Range("D2:D41") 'Fourth column data
Set xDRg5 = Range("E2:E7") 'Fifth column data
xStr = "-" 'Separator Set
xRg = Range("F2") 'Output cell
For xFN1 = 1 To xDRg1.Count
xSV1 = xDRg1.Item(xFN1).Text
For xFN2 = 1 To xDRg2.Count
xSV2 = xDRg2.Item(xFN2).Text
For xFN3 = 1 To xDRg3.Count
xSV3 = xDRg3.Item(xFN3).Text
For xFN4 = 1 To xDRg4.Count
xSV4 = xDRg4.Item(xFN4).Text
For xFN5 = 1 To xDRg5.Count
xSV5 = xDRg5.Item(xFN5).Text
xRg.Value = xSV1 & xStr & xSV2 & xStr & xSV3 & xStr & xSV4 & xStr & xSV5
Set xRg = xRg.Offset(1, 0)
Next
Next
Next
Next
Next
End
Sub
I would like the excel sheet to generate a new sheet where S/N 1048577 and so on are generated.