Hi there, two questions.(both highlighted in bold for TL;DR purposes
I currently have the below macro which I use to generate every permutation of 5 variables (currently all set from 1-6)
When I have more than need the variables to be different numerals I can easily edit to make that happen, however if I want more than 5 variables or significantly more than 6 options for each variable this macro takes ages to generate it, is there a streamlining option I've missed?
Also, if I want the variable output to be letters or labels rather than numbers, or if I need it to be dates and times is there an easy edit for doing just that? at the moment I'm using find replace on my numerals and manually editing but it's quite time inefficient and I was hoping to be able to build soemthing into the macro.
I currently have the below macro which I use to generate every permutation of 5 variables (currently all set from 1-6)
Sub Permutations()
Dim i As Integer, n As Integer, o As Integer, p As Integer, q As Integer, r As Integer
i = 1
For r = 1 To 6
For q = 1 To 6
For p = 1 To 6
For o = 1 To 6
For n = 1 To 6
Range("A" & i).Value = r
Range("B" & i).Value = q
Range("C" & i).Value = p
Range("D" & i).Value = o
Range("E" & i).Value = n
i = i + 1
Next n
Next o
Next p
Next q
Next r
End Sub
When I have more than need the variables to be different numerals I can easily edit to make that happen, however if I want more than 5 variables or significantly more than 6 options for each variable this macro takes ages to generate it, is there a streamlining option I've missed?
Also, if I want the variable output to be letters or labels rather than numbers, or if I need it to be dates and times is there an easy edit for doing just that? at the moment I'm using find replace on my numerals and manually editing but it's quite time inefficient and I was hoping to be able to build soemthing into the macro.