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
| Option Explicit
Public T() As Variant
Sub usf()
acquisition
UserForm1.Show
End Sub
Sub acquisition(Optional x As Byte = 0)
Dim lig As Integer, col As Integer
With Sheets("BDD")
lig = .Range("A" & Rows.Count).End(xlUp).Row + x
col = .Cells(1, 1).End(xlToRight).Column
T = .Range(Cells(1, 1), Cells(lig, col)).Value
End With
End Sub
Private Const Nb = 14 ' nb de textbox de l'usf
Private Id As Integer
Private Sub UserForm_Initialize()
Id = LBound(T, 1) + 1
Remplir (Id)
End Sub
Private Sub Remplir(Idx As Integer)
Dim i As Byte
For i = 1 To Nb
Controls("Label" & i).Caption = T(1, i)
Controls("Textbox" & i).Value = T(Idx, i)
Next i
End Sub
Private Sub Sauve(Idx As Integer)
Dim i As Byte
For i = 1 To Nb
T(Idx, i) = Controls("Textbox" & i).Value
Next i
End Sub
Private Sub CommandButton2_Click() ' Suivant
Sauve (Id)
Id = Id + 1
If Id > UBound(T, 1) Then Id = LBound(T, 1) + 1
Remplir (Id)
End Sub
Private Sub CommandButton3_Click() ' Quitter
Sauve (Id)
Unload Me |
Partager