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
| Option Explicit
Private Sub CommandButton1_Click()
TextBox1 = Date
End Sub
Private Sub CommandButton2_Click()
Dim fin2 As Integer
Dim sec As Integer
Dim Y As Integer, X As Integer, A
If IsDate(TextBox1) = False Then MsgBox ("Manque la date"): Exit Sub
If TextBox1 = "" Then MsgBox ("Manque la date"): Exit Sub
If ListBox2.ListIndex = -1 Then MsgBox ("Manque la formation"): Exit Sub
If TextBox2 = "" Then MsgBox ("Manque la durée"): Exit Sub
fin2 = finf7 + 1
sec = PV + 1
Y = 8
A = 1
Feuil17.Cells(fin2, 1) = CDate(TextBox1)
Feuil17.Cells(fin2, 2) = ListBox2.ListIndex
Feuil17.Cells(fin2, 4) = Val(TextBox2)
Feuil17.Cells(fin2, 5) = TextBox3
For X = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(X) = True Then
Feuil17.Cells(fin2, Y) = ListBox1.List(X, 1) & " " & ListBox1.List(X, 2) & " " & ListBox1.List(X, 3): Y = Y + 1
Feuil14.Cells(PV, A) = ListBox1.List(X, 1) & " " & ListBox1.List(X, 2) & " " & ListBox1.List(X, 3): A = A + 1
Feuil18.Cells(X + 2, ListBox2.ListIndex + 2) = Feuil18.Cells(X + 2, ListBox2.ListIndex + 2) + Val(TextBox2)
End If
Next
TextBox1 = ""
TextBox2 = ""
Lfor
Me.Hide
End Sub
Private Sub CommandButton3_Click()
With ActiveSheet
For i = 0 To .ListBox1.ListCount - 1
If .ListBox1.Selected(i) = True Then
.ListBox3.AddItem .ListBox1.List(i)
.ListBox1.Selected(i) = False
End If
Next i
End With
End Sub
Private Sub ListBox1_Click()
End Sub
Private Sub UserForm_Activate()
Dim tablo As Variant
Dim derligne
TextBox1.Text = ""
With feuil9
derligne = .Range("a65536").End(xlUp).Row
tablo = .Range("a2:d" & derligne)
ListBox1.List = tablo
End With
With Feuil18
derligne = .Range("iu1").End(xlToLeft).Address
tablo = .Range("b1:" & derligne)
ListBox2.List = WorksheetFunction.Transpose(tablo)
End With
End Sub |
Partager