1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Sub untableau()
nbdeligne = Worksheets(1).Cells(65535, 1).End(xlUp).Row
k = 1
ReDim tableaudevariable(k)
tableaudevariable(k) = Cells(k, 1)
For k = 1 To nbdeligne
j = UBound(tableaudevariable)
For i = 1 To j
If Cells(k + 1, 1) = tableaudevariable(i) Then
u = False
MsgBox " variable déja existante en " & Chr(10) _
& Cells(k + 1, 1).Address & Chr(10) _
& "c'est le " & Cells(k + 1, 1)
Exit For
Else:
u = True
End If
Next i
If u = True Then
ReDim Preserve tableaudevariable(j + 1)
tableaudevariable(j + 1) = Cells(k + 1, 1)
End If
Next k
For i = 1 To j
MsgBox "variables entrées " & tableaudevariable(i)
Next
End Sub |