XL 2010 Excel : erreur d'exécution '-2147024809 (80070057)' liée au UserForm1.Show vbModeless

LolaPF

XLDnaute Nouveau
Bonjour, bonjour,

J'ai un soucis dans l'exécution de mon codage de création de formulaire. Le débogage m'indique que cela provient de "UserForm1.Show vbModeless" et en passant dessus ce dernier me dit "vbModeless = 0" je ne comprends pas ...

Je suis une grande débutante mais si vous trouver mon erreur, vous m'enlèverez une épine du pied !
Ci après mes codes : module + userform1
Et en pièce-jointe le doc Excel pour vos tests.

Merci d'avance !

Voici mon module :
Sub Formulaire_inscription()
UserForm1.Show vbModeless
End Sub

Voici mon UserForm1 :
Option Explicit
Dim Ws As Worksheet

'Pour le formulaire
Private Sub UserForm_Initialize()
Dim J As Long
Dim I As Integer

ComboBox2.ColumnCount = 1 'Pour la liste déroulante Niveau
ComboBox2.List() = Array("", "ADULTE", "ENFANT", "MATAHIAPO")
Set Ws = Sheets("Liste") 'Correspond au nom de votre onglet dans le fichier Excel
With Me.ComboBox1
For J = 2 To Ws.Range("A" & Rows.Count).End(xlUp).Row
.AddItem Ws.Range("A" & J)
Next J
End With
For I = 1 To 8
Me.Controls("TextBox" & I).Visible = True
Next I
End Sub

'Pour le bouton Nouvelle inscription
Private Sub CommandButton1_Click()
Dim L As Integer
If MsgBox("Confirmez-vous l'insertion de ce nouvel inscrit ?", vbYesNo, "Demande de confirmation d’ajout") = vbYes Then
L = Sheets("Liste").Range("a65536").End(xlUp).Row + 1 'Pour placer le nouvel enregistrement à la première ligne de tableau non vide
Range("A" & L).Value = ComboBox1
Range("B" & L).Value = ComboBox2
Range("C" & L).Value = TextBox1
Range("D" & L).Value = TextBox2
Range("E" & L).Value = TextBox3
Range("F" & L).Value = TextBox4
Range("G" & L).Value = TextBox5
Range("H" & L).Value = TextBox6
Range("I" & L).Value = TextBox7
Range("J" & L).Value = TextBox8
End If
End Sub

'Pour le bouton Modifier
Private Sub CommandButton2_Click()
Dim Ligne As Long
Dim I As Integer

If MsgBox("Confirmez-vous la modification de cet inscrit ?", vbYesNo, "Demande de confirmation de modification") = vbYes Then
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
Ligne = Me.ComboBox1.ListIndex + 2
Ws.Cells(Ligne, "B") = ComboBox2
For I = 1 To 8
If Me.Controls("TextBox" & I).Visible = True Then
Ws.Cells(Ligne, I + 2) = Me.Controls("TextBox" & I)
End If
Next I
End If
End Sub


'Pour le bouton Quitter
Private Sub CommandButton3_Click()
Unload Me
End Sub

End Sub
 

Pièces jointes

  • Formulaire.xlsx
    14.9 KB · Affichages: 13

Statistiques des forums

Discussions
312 112
Messages
2 085 411
Membres
102 885
dernier inscrit
AISSOU