Veja se auxilia
Sub letraspermutadas()
Dim MyTxt(1 To 4) As String
Dim a As Integer, b As Integer, c As Integer, d As Integer
MyTxt(1) = "MA"
MyTxt(2) = "MD"
MyTxt(3) = "FA"
MyTxt(4) = "F5"
conta = 1
For a = 1 To 4
For b = 1 To 4
For c = 1 To 4
For d = 1 To 4
If IsInArray(MyTxt(a), Array(MyTxt(b), MyTxt(c), MyTxt(d))) Or _
IsInArray(MyTxt(b), Array(MyTxt(a), MyTxt(c), MyTxt(d))) Or _
IsInArray(MyTxt(c), Array(MyTxt(a), MyTxt(b), MyTxt(d))) Or _
IsInArray(MyTxt(d), Array(MyTxt(a), MyTxt(b), MyTxt(c))) Then GoTo ali
Cells(conta, 1) = "1" & MyTxt(a) & "2" & MyTxt(b) & "3" & MyTxt(c) & "4" & MyTxt(d)
conta = conta + 1
ali:
Next
Next
Next
Next
End Sub
Obs.: Está "escrevendo"na planilha, deve adaptar ao seu form.
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 26/11/2017 7:49 am