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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
| Option Explicit
Dim Ws As Worksheet
Private Sub ComboBox1_Change()
'Private Sub ComboBox1_Change()
Application.ScreenUpdating = False
Dim plage As Range
Dim cell As Range
Dim codrecherché
Set plage = Sheets("études").Range("A3:A" & [A65536].End(xlUp).Row)
codrecherché = ComboBox1.Value
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
For Each cell In plage
If cell.Value = codrecherché Then
TextBox1.Value = Cells(cell.Row, 2)
TextBox2.Value = Cells(cell.Row, 3)
ComboBox2.Value = Cells(cell.Row, 4)
TextBox3.Value = Cells(cell.Row, 5)
TextBox4.Value = Cells(cell.Row, 6)
TextBox5.Value = Cells(cell.Row, 7)
ComboBox3.Value = Cells(cell.Row, 8)
ComboBox4.Value = Cells(cell.Row, 9)
TextBox6.Value = Cells(cell.Row, 10)
ComboBox5.Value = Cells(cell.Row, 11)
TextBox7.Value = Cells(cell.Row, 12)
ComboBox6.Value = Cells(cell.Row, 13)
ComboBox7.Value = Cells(cell.Row, 14)
ComboBox8.Value = Cells(cell.Row, 15)
ComboBox9.Value = Cells(cell.Row, 16)
TextBox8.Value = Cells(cell.Row, 17)
ComboBox10.Value = Cells(cell.Row, 18)
'continuer à remplir les autres textbox
End If
Next cell
Application.ScreenUpdating = True
End Sub
Private Sub ComboBox3_Change()
End Sub
Private Sub ComboBox8_Change()
End Sub
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim myPassword As String
myPassword = "Lise1234"
ThisWorkbook.Sheets("études").Unprotect Password:=myPassword
Dim plage As Range
Dim cell As Range
Dim codrecherché
Set plage = Sheets("études").Range("A3:A" & [A65536].End(xlUp).Row)
codrecherché = ComboBox1.Value
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
For Each cell In plage
If cell.Value = codrecherché Then
Cells(cell.Row, 2) = TextBox1.Value
Cells(cell.Row, 3) = TextBox2.Value
Cells(cell.Row, 4) = ComboBox2.Value
Cells(cell.Row, 5) = TextBox3.Value
Cells(cell.Row, 6) = TextBox4.Value
Cells(cell.Row, 7) = TextBox5.Value
Cells(cell.Row, 8) = ComboBox3.Value
Cells(cell.Row, 9) = ComboBox4.Value
Cells(cell.Row, 10) = TextBox6.Value
Cells(cell.Row, 11) = ComboBox5.Value
Cells(cell.Row, 12) = TextBox7.Value
Cells(cell.Row, 13) = ComboBox6.Value
Cells(cell.Row, 14) = ComboBox7.Value
Cells(cell.Row, 15) = ComboBox8.Value
Cells(cell.Row, 16) = ComboBox9.Value
Cells(cell.Row, 17) = TextBox8.Value
Cells(cell.Row, 18) = ComboBox10.Value
'continuer à remplir les autres textbox
End If
Next cell
ThisWorkbook.Sheets("études").Protect Password:=myPassword
' Affiche une boîte de message
MsgBox ("étude modifiée dans la liste étude")
Unload Me ' Vide et ferme l'Userform ( formulaire)
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
Unload Mod_Fournisseur
End Sub
Private Sub Label1_Click()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub TextBox7_Change()
End Sub
Private Sub UserForm_Initialize()
Dim J As Long
Dim I As Integer
Set Ws = Sheets("études")
With Me.ComboBox1
For J = 2 To Ws.Range("A" & Rows.Count).End(xlUp).Row
.AddItem Ws.Range("A" & J)
Next J
End With
End Sub |