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
| Sub SaveCustomer()
Dim i
Dim Row As ListRow
i = Application.Match(Range("fc_Id").Value, Range("t_Clients[Id]"), 0)
If IsError(i) Then
Set Row = Range("t_Clients").ListObject.ListRows.Add()
Else
Set Row = Range("t_Clients").ListObject.ListRows(i)
End If
SaveData "Client", Row
End Sub
Sub ReadActiveCustomer()
Dim i As Long
i = ActiveCell.Row - Range("t_Clients[#Headers]").Row
ReadData "Client", Range("t_Clients").ListObject.ListRows(i)
End Sub
Sub PrepareforNewCustomer()
Range("fc").ClearContents
Range("fc_Id") = Application.Max(Range("t_clients[Id]")) + 1
Range("fc_Nom").Select
End Sub
Sub ReadCustomerFromForm()
Dim i
i = Application.Match(Range("fc_Id").Value, Range("t_Clients[Id]"), 0)
Range("fc").ClearContents
If IsError(i) Then
MsgBox "Ce client n'existe pas"
Else
ReadData "Client", Range("t_Clients").ListObject.ListRows(i)
End If
End Sub |
Partager