Erreur de compil

Fermé
jack - 4 sept. 2019 à 08:57
 jack - 4 sept. 2019 à 11:12
bonjour à tous
dans le débogage suivant j'ai un problème à la ligne Call TriSeltd)
pourquoi; merci d'avance
Public Function Suite(plage As Range, n As Byte) As String
Dim td(), ntd As Long, k As Byte, i As Long, cel As Range, ok As Boolean, s As String
ntd = plage.Cells.Count
ReDim td(1 To ntd)
ok = False
i = 0
For Each cel In plage
i = i + 1
td(i) = cel.Value
Next cel
Call TriSel(td)
'MsgBox td(1) & "-" & td(2) & "-" & td(3) & "-" & td(4) & "-" & td(5)
Select Case n
Case 2:
For k = 1 To ntd - 1
If td(k + 1) = td(k) + 1 Then
ok = True
s = td(k) & "-" & td(k + 1)
Exit For
End If
Next k
Case 3:
For k = 1 To ntd - 2
If td(k + 2) = td(k + 1) + 1 And td(k + 1) = td(k) + 1 Then
ok = True
s = td(k) & "-" & td(k + 1) & "-" & td(k + 2)
Exit For
End If
Next k
End Select
If ok Then
Suite = s
Else
Suite = "pas de suite"
End If
End Function

1 réponse

T3chN0g3n Messages postés 4970 Date d'inscription samedi 16 février 2019 Statut Membre Dernière intervention 12 avril 2024 1 095
Modifié le 4 sept. 2019 à 09:10
Bonjour,

Cette fonction appel une autre marco ("TriSel") avec un passage de paramètre (ici "td"). Il faut vérifier que ce paramètre soit bien définis dans l'autre macro.

Par exemple:
Sub TriSel (nom_d'une_variable as string)


Cordialement
1
merci a toi Tout fonctionne
0