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
|
Private Sub UserForm_initialize()
Dim derlig As Long
derlig = BASEINTERVENTIONS.[A65000].End(xlUp).Row
With Me.ListView1
.View = 3
.Gridlines = True
With .ColumnHeaders
.Add , , "NUMERO DEMANDE", 80
.Add , , "TRAVAUX DEMANDES", 150
.Add , , "AUTO 24", 50
.Add , , "GARAGISTE", 50
.Add , , "DATE DEBUT TRAVAUX", 60
.Add , , "TRAVAUX REALISES", 30
.Add , , "DATE RESTITUTION", 60
.Add , , "VALIDATION FACTURE", 30
.Add , , "COMMENTAIRES", 200
.Add , , "FACTURE ", 80
End With
For I = 2 To derlig
.ListItems.Add , , BASEINTERVENTIONS.Cells(I, 5).Value
.ListItems(.ListItems.Count).ListSubItems.Add , , BASEINTERVENTIONS.Cells(I, 10).Value
.ListItems(.ListItems.Count).ListSubItems.Add , , BASEINTERVENTIONS.Cells(I, 11).Value
.ListItems(.ListItems.Count).ListSubItems.Add , , BASEINTERVENTIONS.Cells(I, 12).Value
.ListItems(.ListItems.Count).ListSubItems.Add , , Format(BASEINTERVENTIONS.Cells(I, 13).Value, "dd/mm/yyyy")
.ListItems(.ListItems.Count).ListSubItems.Add , , BASEINTERVENTIONS.Cells(I, 14).Value
.ListItems(.ListItems.Count).ListSubItems.Add , , Format(BASEINTERVENTIONS.Cells(I, 15).Value, "dd/mm/yyyy")
.ListItems(.ListItems.Count).ListSubItems.Add , , BASEINTERVENTIONS.Cells(I, 16).Value
.ListItems(.ListItems.Count).ListSubItems.Add , , BASEINTERVENTIONS.Cells(I, 17).Value
.ListItems(.ListItems.Count).ListSubItems.Add , , BASEINTERVENTIONS.Cells(I, 18).Value
Next I
End With
End Sub
Private Sub ListView1_BeforeLabelEdit(Cancel As Integer)
End Sub
Private Sub ListView1_click()
Me.TextBox1.Text = ListView1.SelectedItem.Text
Me.TextBox2.Text = ListView1.SelectedItem.ListSubItems(1).Text
Me.TextBox3.Text = ListView1.SelectedItem.ListSubItems(2).Text
Me.ComboBox1.Text = ListView1.SelectedItem.ListSubItems(3).Text
Me.TextBox4.Value = ListView1.SelectedItem.ListSubItems(4).Text
Me.ComboBox2.Text = ListView1.SelectedItem.ListSubItems(5).Text
Me.ComboBox3.Text = ListView1.SelectedItem.ListSubItems(7).Text
Me.TextBox5.Value = ListView1.SelectedItem.ListSubItems(6).Text
Me.TextBox6.Text = ListView1.SelectedItem.ListSubItems(8).Text
Me.TextBox7.Text = ListView1.SelectedItem.ListSubItems(9).Text
End Sub
Private Sub CommandButton1_Click()
ListView1.SelectedItem.Text = Me.TextBox1.Text
ListView1.SelectedItem.ListSubItems(1).Text = Me.TextBox2.Text
ListView1.SelectedItem.ListSubItems(2).Text = Me.TextBox3.Text
ListView1.SelectedItem.ListSubItems(3).Text = Me.ComboBox1.Text
ListView1.SelectedItem.ListSubItems(4).Text = CDate(Me.TextBox4.Value)
ListView1.SelectedItem.ListSubItems(5).Text = Me.ComboBox2.Text
ListView1.SelectedItem.ListSubItems(6).Text = CDate(Me.TextBox5.Value)
ListView1.SelectedItem.ListSubItems(7).Text = Me.ComboBox3.Text
ListView1.SelectedItem.ListSubItems(8).Text = Me.TextBox6.Text
ListView1.SelectedItem.ListSubItems(9).Text = Me.TextBox7.Text
Dim I As Integer
Dim J As Byte
Dim K As Integer
K = 2
For I = 1 To ListView1.ListItems.Count
BASEINTERVENTIONS.Cells(K, 5) = ListView1.ListItems(I).Text
For J = 1 To ListView1.ColumnHeaders.Count - 1
If J = 4 Or J = 6 Then
BASEINTERVENTIONS.Cells(K, J + 9) = CDate(ListView1.ListItems(I).ListSubItems(J).Text)
Else
BASEINTERVENTIONS.Cells(K, J + 9) = ListView1.ListItems(I).ListSubItems(J).Text
End If
Next J
BASEINTERVENTIONS.Cells(K, 19).FormulaR1C1 = "=RC[-4]-RC[-6]"
BASEINTERVENTIONS.Cells(K, 20).FormulaR1C1 = "=RC[-7]-RC[-11]"
K = K + 1
Next I
End Sub |
Partager