There are 840 unique permutations of the 7 values. This small macro, TEST, will list them in column A:
Sub TEST()
Dim j As Long, k As Long
k = 1
Application.ScreenUpdating = False
For j = 1333459 To 9543331
If NumCheck(CStr(j)) Then
Cells(k, 1) = j
k = k + 1
' If k = 1000 Then Exit Sub
End If
Next
Application.ScreenUpdating = True
End Sub
Function NumCheck(s As String) As Boolean
NumCheck = False
If InStr(s, "0") + InStr(s, "2") + InStr(s, "6") + InStr(s, "7") + InStr(s, "8") = 0 Then
If Len(Replace(s, "1", "")) = 6 And Len(Replace(s, "4", "")) = 6 And Len(Replace(s, "9", "")) = 6 Then
If Len(Replace(s, "3", "")) = 4 Then
NumCheck = True
Exit Function
End If
End If
End If
End Function
Macros are very easy to install and use:
1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window
If you save the workbook, the macro will be saved with it.
To remove the macro:
1. bring up the VBE window as above
2. clear the code out
3. close the VBE window
To use the macro from Excel:
1. ALT-F8
2. Select the macro (TEST)
3. Touch RUN
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
Macros must be enabled for this to work!
Bookmarks