Private Sub Command1_Click()
Dim b(), i&, j&, k&, ii&, jj&, c&, num&()
a = Split(Text1, vbCrLf)
k = UBound(a)
If Not IsNumeric(a(k)) Then k = k - 1
ReDim b(k, 5)
For i = 0 To k
For j = 0 To 5
b(i, j) = Split(a(i), " ")(j)
Next
Next
ReDim num(0)
num(0) = 0
For i = 1 To k
For j = 0 To UBound(num)
c = 0
For ii = 0 To 5
For jj = 0 To 5
If b(i, ii) = b(num(j), jj) Then c = c + 1
Next
Next
If c >= 5 Then Exit For
Next
If j = UBound(num) + 1 Then
ReDim Preserve num(j)
num(j) = i
End If
Next
Text1 = ""
For i = 0 To UBound(num) - 1
Text1 = Text1 & a(num(i)) & vbCrLf
Next
Text1 = Text1 & a(num(i)) & vbCrLf
End Sub