Ecrire dans la source
S
Hello à tous,
J'ai tenté de visualiser (pendant quelques heures) où est le "bug" dans l'écriture...durant mon absence on a modifié quelques peu la programmation mais semble n'y avoir rien de trop complexe... je ne comprends pas ce qui ne fonctionne pas
J'ai ajouté une colonne No.dossier dans ma source que j'ai intitulé Textbox21 puis insérer dans mon code. Qui peut me dire ce qu'il me manque ou ce que j'ai oublié car lorsque j'ouvre ma base et renseigne tout mes champs.. ils sont décalés de 1 ... voici la source dans laquelle j'inscris à partir de ma base de données puis mon code. Merci ++
Ma source :
'Inscrire dans la source
Private Sub Boutoninscrire2_Click()
Dim Rcell As Range
Dim NbLig As Integer
Dim Ligne As Integer
Dim DerLigne As Integer
Dim i As Integer
DerLigne = Sheets("Inscriptions").Range("D" & Rows.Count).End(xlUp).Row + 1
Ligne = 0
With Sheets("Inscriptions")
.Activate
If Application.WorksheetFunction.CountA(Range("E7:E26")) = 20 Then
MsgBox "Tableau complet", vbOKOnly + vbInformation, "COMFIRMATION"
Unload Me
ElseIf ChoixRLS = "" Or NUM = "" Or TextBox21 = "" Or nomprenom = "" Or choixlangue = "" Or _
TextBox12 = "" Or datenaissance = "" Or IntPivot = "" Or _
profilintervention = "" Or oemcdate = "" Then
MsgBox ("Tous les champs obligatoire ne sont pas correctement remplis"), vbExclamation, ""
Else ' <>
If MsgBox("Voulez-vous vraiment inscrire cet usager ?", vbQuestion + vbYesNo, "") = vbYes Then
Application.ScreenUpdating = False
.Unprotect Password:="sapa23"
With .ListObjects("Tableau12")
If WorksheetFunction.CountA(Range("Tableau12['#]")) = 0 Then
Ligne = 7
ElseIf WorksheetFunction.CountA(Range("Tableau12['#]")) > 0 Then
For i = 7 To DerLigne
If Range("C" & i).Value = "" Or Range("E" & i).Value = "" Then
Ligne = Range("E" & i).Row
i = DerLigne
End If
Next i
End If
End With
.Cells(Ligne, 3) = ChoixRLS
If Cells(Ligne, 4) = "" Then: .Cells(Ligne, 4) = NUM
.Cells(Ligne, 5) = TextBox21
.Cells(Ligne, 6) = nomprenom
.Cells(Ligne, 7) = choixlangue
.Cells(Ligne, 8) = TextBox12
.Cells(Ligne, 9) = datenaissance
.Cells(Ligne, 10) = IntPivot
.Cells(Ligne, 11) = profilintervention
.Cells(Ligne, 12) = profilisosmaf
.Cells(Ligne, 13) = Format(Me.oemcdate.Value, "YYYY/MM/DD")
.Protect Password:="sapa23"
MsgBox "Les informations ont été ajoutés à la base de donnée", vbOKOnly + vbInformation, "COMFIRMATION"
Unload Me
Application.ScreenUpdating = True
End If
End If
End With
End Sub For i = 7 To DerLigne
If Range("C" & i).Value = "" Or Range("E" & i).Value = "" Then
Ligne = Range("E" & i).Row
i = DerLigne
Exit For ' première ligne avec C ou E vide trouvé
End If
Next idès que vous avez trouvé votre ligne, vous pouvez quiter le "For...Next" avec ce "Exit For"