Alright, there are some teams in the 6th column, starting from the 8th row, and I want to add each one to the allTeams array, but only if the team isn't already in the array, therefore the same team won't be added 2 or more times into the allTeams array.
Here's more of the code (changed i-7 to j to keep it more easy to read):
Private Sub CommandButton3_Click()
Dim i, j As Integer
Dim allTeams() As String
i = 8
j = i - 7
Do Until IsEmpty(cells(i, 1)) 'The first loop goes down the 6th column, to check all the teams
Do Until allTeams(j) <> "" 'I wanted this loop to check the array if the current team is already there, or not
If allTeams(j) = cells(i, 6) Then
'Don't care about this case, I want every team just once
Else
ReDim Preserve allTeams(j)
allTeams(j) = cells(i, 6)
End If
j = j + 1
Loop
i = i + 1
Loop
UserForm2.Show
End Sub
Bookmarks