Bonjour,

J'ai un petit soucis dans la maîtrise des conditions if et elseif sous VBA:

J'aimerais écrire les conditions suivantes:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
If valeur1 = a and valeur2 = b and valeur3 = c
"Alors, si" :
valeur4 = x then cells(1,1) = 1
Sinon, si valeur4 = y then cells(1,1) = 2
Sinon, si valeur4 = z then cells(1,1) = 3
Quelqu'un a une idée ?

pour l'instant, j'ai écrit cela :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
If valeur1 = a and valeur2 = b and valeur3 = c and valeur4 = x then cells(1,1) = 1
If valeur1 = a and valeur2 = b and valeur3 = c and valeur4 = y then cells(1,1) = 2
If valeur1 = a and valeur2 = b and valeur3 = c and valeur4 = z then cells(1,1) = 3
Cette solution fonctionne, mais prend beaucoup trop de place dans mon cas de figure qui contient beaucoup de conditions...

Merci d'avance pour votre aide..