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
| Sub TestMatch()
Dim ListTooLong(65536) As String, ListGood(65535) As String, ListCellules(1 To 100000, 1 To 1) As String, i As Long, msg As String
For i = 0 To 65535
ListGood(i) = "List " & i
Next
msg = "Si la variable tableau contient moins de 65536 valeurs, Match fonctionne : " & _
Application.WorksheetFunction.Match("List 65527", ListGood, 0)
For i = 0 To 65536
ListTooLong(i) = "List " & i
Next i
On Error Resume Next
Debug.Print Application.WorksheetFunction.Match("List 65527", ListTooLong, 0)
If Err.Number > 0 Then
msg = msg & vbCrLf & "___________________________________________" & vbCrLf & vbCrLf & _
"Si la variable tableau contient plus de 65536 valeurs, Match ne fonctionne pas : " & vbCrLf & Err.Description
End If
On Error GoTo 0
For i = 1 To 100000
ListCellules(i, 1) = "List " & i
Next i
Range("A1").Resize(UBound(ListCellules, 1), 1) = ListCellules
msg = msg & vbCrLf & "___________________________________________" & vbCrLf & vbCrLf & _
"Dans la feuille de calcul avec plus de 65536 valeurs, Match fonctionne : " & _
Application.WorksheetFunction.Match("List 99527", Range("A1:A100000"), 0)
MsgBox msg
End Sub |
Partager