Eviter des longues lignes d'instructions IF...ELSEIF....END IF
Fermé
pointfinal
-
11 avril 2017 à 08:49
gbinforme Messages postés 14939 Date d'inscription lundi 18 octobre 2004 Statut Contributeur Dernière intervention 24 juin 2020 - 11 avril 2017 à 10:05
gbinforme Messages postés 14939 Date d'inscription lundi 18 octobre 2004 Statut Contributeur Dernière intervention 24 juin 2020 - 11 avril 2017 à 10:05
A voir également:
- Eviter des longues lignes d'instructions IF...ELSEIF....END IF
- If exist ✓ - Forum Autoit / batch
- Vba if not ✓ - Forum Excel
- Connexion messenger if - Guide
- Php if plusieurs conditions ✓ - Forum PHP
- End clothing avis - Forum Consommation et internet
2 réponses
michel_m
Messages postés
16593
Date d'inscription
lundi 12 septembre 2005
Statut
Contributeur
Dernière intervention
7 mars 2023
3 291
Modifié le 11 avril 2017 à 10:09
Modifié le 11 avril 2017 à 10:09
gbinforme
Messages postés
14939
Date d'inscription
lundi 18 octobre 2004
Statut
Contributeur
Dernière intervention
24 juin 2020
4 656
11 avril 2017 à 10:05
11 avril 2017 à 10:05
Bonjour,
Tu peux simplifier en rentrant tes paramètres en constantes
Tu peux simplifier en rentrant tes paramètres en constantes
Sub listederoulante()
Const pc = "F1,L1,M1,K1,T1,Y1,E1,S1,B1,E1,N1,M1,E1,"
Const pi = "1,100,100,150,30,10,100,100,100,100,100,100,100,"
Const pm = "100,10,0,100,30,10,100,10,10,150,10,10,10,"
Const pn = "200,0,100,0,30,10,0,10,100,10,15,155,10,"
Dim pos As Long, concession As String, i As Long, n As Long, m As Long, tbp
concession = UCase(Cells(6, 19).Value)
pos = InStr(pc, concession & ",")
tbp = Split(Left(pc, pos), ",")
If UBound(tbp) >= 0 Then
n = Split(pn, ",")(UBound(tbp))
m = Split(pm, ",")(UBound(tbp))
i = Split(pi, ",")(UBound(tbp))
Else
MsgBox "paramétres erronés"
End If
End Sub
