insérer un AND dans un IF
Bonjour,
je souhaiterai savoir la marche à suivre pour insérer une double condition sous IF. Alors je ne sais pas si je dois passer par un AND ou imbriquer un autre IF.
voici mon code:
Code:
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 29 30 31 32 33 34 35 36
| Private Sub CommandButton1_Click()
If TextBox1.Value <> "" And TextBox2.Value <> "" Then
Worksheets("BM").Range("E1") = TextBox1.Value
Worksheets("Coef Vente").Range("C3") = TextBox2.Value
If OptionButton1 = True Then
Worksheets("BM").Range("E8") = "Logements -"
Infos.Hide
lgt.Show
Else
If OptionButton2 = True Then
Worksheets("BM").Range("E8") = "Bureaux -"
Infos.Hide
bureaux.Show
Else
If OptionButton3 = True Then
Worksheets("BM").Range("E8") = "Santé -"
Infos.Hide
sante.Show
Else
If OptionButton4 = True Then
Worksheets("BM").Range("E8") = "Crèche -"
Infos.Hide
crèche.Show
End If
End If
End If
End If
Else
MsgBox "il manque des informations"
End If
End Sub |
je souhaiterai pouvoir faire ceci:
afficher du texte en fonction des combinaisons:
OptionButton1 = true et OptionButton5 = true
OptionButton1 = true et OptionButton6 = true
OptionButton2 = true et OptionButton5 = true
OptionButton2 = true et OptionButton6 = true
etc...
mais seul la valeur de OptionButton1, OptionButton2, OptionButton3, OptionButton4 influence le userform qui doit s'afficher ensuite.
merci
jb