Private Sub CommandButton1_Click() 'valider changement
Dim L As Long, C As Long
If Me.OptionButton1 Then 'ajouter
With F1 'proat1
L = .Range("B65536").End(xlUp).Row + 1 'ajout
Me.TextBox1 = L - 1 'n°
For C = 1 To 17
Select Case Me("TextBox" & C)
Case IsNumeric(Me("TextBox" & C))
.Cells(L, C) = Me("TextBox" & C) * 1 'ou cdbl(Me("TextBox" & C))
.Cells(L, 8).NumberFormat = "#,##0.00" 'tonnage
.Cells(L, 9).NumberFormat = "0.000" 'debit instant
Case IsDate(Me("TextBox" & C))
.Cells(L, C) = CDate(Me("TextBox" & C))'date
.Cells(Li, C).NumberFormat = "dd/mm/yyyy"'formate date
Case Else
.Cells(L, C) = Me("TextBox" & C)
End Select
Next C
End With
BorderF1 L 'module8
End If
If Me.OptionButton2 Then 'modifier
Li = Me.ListView1.SelectedItem.Index
Li = CLng(Mid(Me.ListView1.ListItems(Li).Key, 2))
With F1 'proat1
For C = 1 To 17
If CStr(.Cells(Li, C)) <> Me("TextBox" & C) Then
Select Case Me("TextBox" & C)
Case IsNumeric(Me("TextBox" & C))
.Cells(Li, C) = Me("TextBox" & C) * 1 'ou cdbl(Me("TextBox" & C))
.Cells(Li, 8).NumberFormat = "#,##0.00" 'tonnage
.Cells(L, 9).NumberFormat = "0.000" 'debit instant
Case IsDate(Me("TextBox" & C))
.Cells(Li, C) = CDate(Me("TextBox" & C))'date
.Cells(Li, C).NumberFormat = "dd/mm/yyyy"'formate date
Case Else
.Cells(Li, C) = Me("TextBox" & C)
End Select
End If
Next C
End With
End If
Me.CommandButton1.Enabled = False
Unload Me
End Sub