select case ComboBox1.Value case Range("Feuil1!C3") : TextBox5.Value = Range("Feuil1!C3") case Range("Feuil1!B4") : TextBox5.Value = Range("Feuil1!C4") ... case else : '.... end select
If ComboBox1.Value = Range("Feuil1!B3") Then TextBox5.Value = Range("Feuil1!C3") elseIf ComboBox1.Value = Range("Feuil1!B4") Then TextBox5.Value = Range("Feuil1!C4") elseIf ComboBox1.Value = Range("Feuil1!B5") Then TextBox5.Value = Range("Feuil1!C5") End If
For I = 3 to 10 If combobox1.value Range("Feuil1!B" & i) then textbox5.value range("Feuil1!" & i) next
Select Case ComboBox1.Value Case Range("Feuil1!B3"): TextBox5.Value = Range("Feuil1!C3") Case Range("Feuil1!B4"): TextBox5.Value = Range("Feuil1!C4") Case Range("Feuil1!B5"): TextBox5.Value = Range("Feuil1!C5") Case Range("Feuil1!B6"): TextBox5.Value = Range("Feuil1!C6") Case Range("Feuil1!B7"): TextBox5.Value = Range("Feuil1!C7") Case Range("Feuil1!B8"): TextBox5.Value = Range("Feuil1!C8") Case Range("Feuil1!B9"): TextBox5.Value = Range("Feuil1!C9") Case Range("Feuil1!B10"): TextBox5.Value = Range("Feuil1!C10") End Select
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionFor I = 3 to 10 If combobox1.value Range("Feuil1!B" & i) then textbox5.value range("Feuil1!C " & i) next
private sub SetValues dim i as integer For i = 3 to 10 If combobox1.value Range("Feuil1!B" & i) then textbox5.value range("Feuil1!C" & i) If combobox2.value Range("Feuil1!F" & i) then textbox6.value range("Feuil1!G" & i) If combobox3.value Range("Feuil1!I" & i) then textbox7.value range("Feuil1!J" & i) If combobox4.value Range("Feuil1!L" & i) then textbox8.value range("Feuil1!M" & i) next end sub
toto = "BFILCGJM" For Q = 1 To Len(toto \ 2) For i = 3 To 10 If Controls("combobox" & Q).Value Range("Feuil1!" & Mid(toto, Q, 1) & i) Then Controls("textbox" & Q + 4).Value Range("Feuil1!" & Mid(toto, Q + 4, 1) & i) Exit For ' (pour ne poas continuer inutilement la boucle I que ce Q) Next Next
If Controls("combobox" & Q).Value = Range("Feuil1!" & Mid(toto, Q, 1) & i) Then Controls("textbox" & Q + 4).Value = Range("Feuil1!" & Mid(toto, Q + 4, 1) & i) Exit For ' (pour ne poas continuer inutilement la boucle I que ce Q) end if ' <<<<<<===== oublié ici