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
| Public li1 As Integer, co1 As Integer
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
co1 = ActiveCell.Column: li1 = ActiveCell.Row
If co1 = 1 Then
UserForm1.Show
End If
End Sub
Public co1 As Integer, li1 As Integer
Dim fourn As String
Private Sub CommandButton1_Click()
' Bouton Valider choix
UserForm1.Hide
Application.ScreenUpdating = False
'
fourn = ComboBox1.Value
' Stockage du choix effectué dans la liste déroulante en D2
Cells(li1, 1).Value = fourn
Cells(li1 + 1, 1).Activate
End Sub
Private Sub CommandButton2_Click()
' Bouton Annuler
UserForm1.Hide
End Sub
Private Sub CommandButton3_Click()
' Bouton Modifier
End Sub
Private Sub UserForm_Activate()
co1 = ActiveCell.Column: li1 = ActiveCell.Row
If co1 = 1 Then
Range("M1") = li1
Me.ComboBox1.ListIndex = -1
ComboBox1.SetFocus
End If
End Sub
Private Sub UserForm_Initialize()
Me.ComboBox1.RowSource = "Feuil1!A101:A" & Sheets("Feuil1").Cells(101, 1).End(xlDown).Row
End Sub |
Partager