VBA, Excel If, ElseIf ,then
Bonjour!
Je n'arrive pas à imbriquer plusieurs conditions au sein d'une sub, voici ce que j'ai fait:
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 37 38 39 40 41 42 43 44 45
| Private Sub Commandbutton_Click()
Worksheets("feuil1").Activate
If optionbutton1 = True Then
If ComboBox.listindex = x Then
label.Caption = Range("A1").Value
If ComboBox.listindex = y Then
label.Caption = Range("A2").Value
Else
label.Caption = Range("A3")
End If
End If
ElseIf optionbutton2 = True Then
If ComboBox.listindex = x Then
label.Caption = Range("B1").Value
If ComboBox.listindex = y Then
label.Caption = Range("B2").Value
Else
label.Caption = Range("B3").Value
End If
End If
ElseIf optionbutton3 = True Then
If ComboBox.listindex = x Then
label.Caption = Range("C1").Value
If ComboBox.listindex = y Then
label.Caption = Range("C2").Value
Else
label.Caption = Range("C3").Value
End If
End If
End If
End Sub |
Et voilà, à chaque fois la même valeur apparaît pour chaque optionbutton respectivement: A3, B3 et C3...
Je vous serais énormément reconnaissant de m'aider!! :) :)
Merci et bonne soirée!!