No dups
Try this version
Option Explicit
Const maxLoops As Long = 100
Const numWanted As Long = 1000
Dim A(1 To 13) As String, T() As String
Dim cntT As Long
Sub drv()
Dim i As Long, iCounter As Long, n As Long
Dim sAll As String
Application.ScreenUpdating = False
cntT = 0
ReDim T(cntT + 1 To numWanted)
For n = 1 To numWanted
iCounter = maxLoops
Application.StatusBar = False
Do While iCounter > 0
Application.StatusBar = n & " -- " & iCounter
sAll = vbNullString
For i = LBound(A) To UBound(A)
Call PickFrom3(i)
sAll = sAll & A(i)
Next i
'max 6 can get symbol 1, max 6 can get symbol X, and 5 can get symbol 2
If HowMany("1") <= 6 And HowMany("X") <= 6 And HowMany("2") <= 5 And _
Max3OnesInFirst4 And Not AlreadyUsed(sAll) Then Exit Do
iCounter = iCounter - 1
Loop
If iCounter = 0 Then
MsgBox "Too many loops = " & iCounter
Else
With ActiveSheet
.Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(1, UBound(A)).Value = A
cntT = cntT + 1
T(cntT) = sAll
End With
Application.StatusBar = False
End If
Next n
Application.ScreenUpdating = True
MsgBox "Done"
End Sub
Function AlreadyUsed(s As String) As Boolean
Dim n As Long
n = -1
On Error Resume Next
n = Application.WorksheetFunction.Match(s, T, 0)
On Error GoTo 0
If n <> -1 Then Stop
AlreadyUsed = IIf(n = -1, False, True)
End Function
'I want combination to exclude where the 4 first slots canīt be nr 1 att same time.
Function Max3OnesInFirst4() As Boolean
Dim i As Long
Max3OnesInFirst4 = False
If A(1) = "1" And A(2) = "1" And A(3) = "1" And A(4) = "1" Then Exit Function
Max3OnesInFirst4 = True
End Function
Function HowMany(s As String) As Long
Dim i As Long, n As Long
For i = LBound(A) To UBound(A)
If A(i) = s Then n = n + 1
Next i
HowMany = n
End Function
Sub PickFrom3(n As Long)
Dim R As Double
R = Rnd
Select Case R
Case Is <= 1 / 3
A(n) = "1"
Case Is <= 2 / 3
A(n) = "X"
Case Else
A(n) = "2"
End Select
End Sub