polska_diane
XLDnaute Nouveau
Bonjour,
J'ai un problème de lenteur lorsque je valide ma userform.
Tout fonctionne bien mais il faut attendre un peu avant que la fenêtre de la userform se ferme. Peut être est ce mon code qui n'est pas bien fait. Pourriez vous m'aider ? Merci d'avance.
J'ai un problème de lenteur lorsque je valide ma userform.
Tout fonctionne bien mais il faut attendre un peu avant que la fenêtre de la userform se ferme. Peut être est ce mon code qui n'est pas bien fait. Pourriez vous m'aider ? Merci d'avance.
VB:
Option Explicit
Private Sub UserForm_Initialize()
'récupère le numéro en AZ1 pour le mettre dans mon textbox80 qui alimentera ma colonne A'
TextBox80 = Sheets("Suivi").Range("AZ1")
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
'ajoute une nouvelle ligne avec les éléments saisie dans mon userform par ordre de numéro de tag'
Dim Ctrl As Control
Dim r As Integer
Dim t As Integer
Dim derligne As Integer
With Worksheets("Suivi")
derligne = .Range("A65536").End(xlUp).Row + 1
For Each Ctrl In Userform1.Controls
r = Val(Ctrl.Tag)
If r > 0 Then Sheets("Suivi").Cells(derligne, r) = Ctrl
Next
Sheets("Suivi").Cells(derligne, 1) = Val(TextBox80)
End With
TextBox80 = ""
End Sub
Private Sub Userform1_beforeupdate()
TextBox12 = Format(TextBox12, "dd mmm yyyy")
TextBox84 = Format(TextBox84, "dd mmm yyyy")
TextBox17 = Format(TextBox17, "dd mmm yyyy")
TextBox18 = Format(TextBox18, "dd mmm yyyy")
TextBox21 = Format(TextBox21, "dd mmm yyyy")
TextBox22 = Format(TextBox22, "dd mmm yyyy")
TextBox23 = Format(TextBox23, "dd mmm yyyy")
TextBox24 = Format(TextBox24, "dd mmm yyyy")
TextBox26 = Format(TextBox26, "dd mmm yyyy")
TextBox79 = Format(TextBox79, "dd mmm yyyy")
TextBox29 = Format(TextBox29, "dd mmm yyyy")
TextBox32 = Format(TextBox32, "dd mmm yyyy")
TextBox33 = Format(TextBox33, "dd mmm yyyy")
TextBox35 = Format(TextBox35, "dd mmm yyyy")
TextBox37 = Format(TextBox37, "dd mmm yyyy")
TextBox39 = Format(TextBox39, "dd mmm yyyy")
End Sub
Private Sub TextBox12_AfterUpdate()
TextBox84.Value = DateAdd("yyyy", 5, TextBox12.Value)
End Sub
Private Sub TextBox17_afterupdate()
TextBox18.Value = DateAdd("yyyy", 1, TextBox17.Value)
End Sub
Private Sub TextBox21_afterupdate()
TextBox22.Value = DateAdd("yyyy", 1, TextBox21.Value)
End Sub
Private Sub TextBox23_afterupdate()
TextBox24.Value = DateAdd("yyyy", 1, TextBox23.Value)
End Sub
Private Sub TextBox26_afterupdate()
TextBox79.Value = DateAdd("yyyy", 1, TextBox26.Value)
End Sub
Private Sub TextBox29_afterupdate()
TextBox32.Value = DateAdd("yyyy", 1, TextBox29.Value)
End Sub
Private Sub TextBox37_afterupdate()
TextBox39.Value = DateAdd("yyyy", 1, TextBox37.Value)
End Sub
Private Sub TextBox10_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox10 = CDate(Me.TextBox10)
End Sub
Private Sub TextBox15_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox15 = CDate(Me.TextBox15)
End Sub
Private Sub TextBox17_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox17 = CDate(Me.TextBox17)
End Sub
Private Sub TextBox18_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox18 = CDate(Me.TextBox18)
End Sub
Private Sub TextBox21_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox21 = CDate(Me.TextBox21)
End Sub
Private Sub TextBox22_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox22 = CDate(Me.TextBox22)
End Sub
Private Sub TextBox23_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox23 = CDate(Me.TextBox23)
End Sub
Private Sub TextBox24_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox24 = CDate(Me.TextBox24)
End Sub
Private Sub TextBox26_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox26 = CDate(Me.TextBox26)
End Sub
Private Sub TextBox29_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox29 = CDate(Me.TextBox29)
End Sub
Private Sub TextBox32_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox32 = CDate(Me.TextBox32)
End Sub
Private Sub TextBox33_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox33 = CDate(Me.TextBox33)
End Sub
Private Sub TextBox35_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox35 = CDate(Me.TextBox35)
End Sub
Private Sub TextBox37_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox37 = CDate(Me.TextBox37)
End Sub
Private Sub TextBox39_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox39 = CDate(Me.TextBox39)
End Sub
Private Sub TextBox79_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Me.TextBox79 = CDate(Me.TextBox79)
End Sub