1 pièce(s) jointe(s)
Numéro ID dans une textbox
Bonjour,
besoin d'aide.
J'ai une feuille excel pour saisir à l'aide d'un formulaire.
J'aimerai avoir un numéro ID pour chaque saisie.
Comment je dois faire ?
Pièce jointe 138081
Merci d'avance.
code actuel:
Code:
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 93 94 95 96 97 98
| Option Explicit
Dim Ws As Worksheet
Private Sub UserForm_Initialize()
Dim i
For i = 1 To 200
ComboBox1.AddItem Sheets("Databasse").Cells(i, 1)
Next
Dim i2
For i2 = 1 To 200
ComboBox2.AddItem Sheets("Databasse").Cells(i2, 2)
Next
End Sub
Private Sub CommandButton3_Click()
Dim L As Integer
Dim Ligne As Long
If MsgBox("Etes-vous certain de vouloir INSERER ce nouveau formulaire à la base de donnée ?", vbYesNo, "Demande de confirmation") = vbYes Then
L = Sheets("Donnée Saisie").Range("a6000").End(xlUp).Row + 1 'Permet de se positionner sur la dernière ligne de tableau NON VIDE
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("A" & L).Value = Range("A1").Value + 1
Range("B" & L).Value = ComboBox1
Range("C" & L).Value = ComboBox2
Range("D" & L).Value = CheckBox1
Range("E" & L).Value = CheckBox2
Range("F" & L).Value = CheckBox3
Range("G" & L).Value = CheckBox4
Range("H" & L).Value = CheckBox5
Range("I" & L).Value = CheckBox6
Range("J" & L).Value = CheckBox7
Range("K" & L).Value = CheckBox8
Range("L" & L).Value = CheckBox9
Range("M" & L).Value = CheckBox10
Range("N" & L).Value = TextBox3
Range("O" & L).Value = CheckBox11
Range("P" & L).Value = CheckBox12
Range("Q" & L).Value = CheckBox13
Range("R" & L).Value = TextBox8
Range("S" & L).Value = CheckBox14
Range("T" & L).Value = CheckBox15
Range("U" & L).Value = TextBox4
Range("V" & L).Value = TextBox5
Range("W" & L).Value = TextBox6
Range("X" & L).Value = TextBox7
Range("A" & L).Borders.LineStyle = xlNone
End If
MsgBox ("Formulaire inséré dans fichier sélectionné") 'Vous informe que le présent contact est insérer dans votre tableau Excel.
Unload Me
UserForm1.Show 'Ouvre le formulaire
End Sub
'Correspond au programme du bouton QUITTER
Private Sub CommandButton4_Click()
Unload Me
End Sub |
1 pièce(s) jointe(s)
Ou est mon problème Numéro ID dans une textbox
Bonjour,
De nouveau un problème, l'incrément de l'ID s'arret après 10 saisie.
Je ne trouve pas l'erreur
Pièce jointe 138181
Merci d'avance
Lien de mon fichier ICI