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
| Option Explicit
Dim F As Worksheet, rng As Range
Private Sub Btn_Modif_Outil_Click()
Dim c As Range, RS As String
Set F = ThisWorkbook.Worksheets("Outil")
If Me.TextBox1 = "" Then MsgBox "Aucun Poste sélectionné!": Exit Sub
RS = Me.ListBox1.rowsource
Me.ListBox1.rowsource = ""
Set c = F.[A:A].Find(Me.TextBox1, LookIn:=xlValues)
If Not c Is Nothing Then
On Error Resume Next
' F.Cells(c.Row, 1) = Me.TextBox1.Value 'No Outil
F.Cells(c.Row, 2) = Me.TextBox2.Value ''site
F.Cells(c.Row, 3) = Me.TextBox3.Value 'p
F.Cells(c.Row, 4).Value = Me.TextBox4.Value ' xxxxxx
F.Cells(c.Row, 5).Value = Me.TextBox5.Value 'marque
F.Cells(c.Row, 6).Value = Me.TextBox6.Value 'no serie
F.Cells(c.Row, 7).Value = CInt(Me.TextBox7.Value) 't
F.Cells(c.Row, 8).Value = CInt(Me.TextBox8) 'i
F.Cells(c.Row, 9).Value = CInt(Me.TextBox9) 'année de fabrication
F.Cells(c.Row, 10).Value = CInt(Me.TextBox10) 'année mise en service
F.Cells(c.Row, 11).Value = Me.TextBox11.Value 'code
F.Cells(c.Row, 12).Value = Me.TextBox12.Value 'observation
F.Cells(c.Row, 13).Value = Me.TextBox13.Value 'etat outil
Me.ListBox1.rowsource = RS
End If
MsgBox "Correction terminée!", vbInformation
End Sub
Private Sub Btn_Ajout_Outil_Click()
Dim i As Byte
For i = 1 To 13
Me.Controls("textbox" & i) = ""
Next
End Sub
Private Sub Btn_Quitter_Click()
Unload Me
End Sub
'
Private Sub ListBox1_Change()
Dim n As Integer
If ListBox1.ListCount <= 1 Or ListBox1.ListIndex < 0 Then
Exit Sub
End If
For n = 0 To 12
Controls("TextBox" & n + 1) = ListBox1.List(ListBox1.ListIndex, n)
Next
End Sub |
Partager