sten83
XLDnaute Occasionnel
Bonjour je rencontre un petit problème avec un code macro je ne comprend pas?
Ci-joint mon code
Voici le message d'erreur
Erreur d'éxécution -2147024809(80070057):
Objet spécifique introuvable
Merci pour votre aide.
Private Sub CmdValideInfoParc_Click()
Dim i As Byte
For i = 1 To 15
If Controls("TextBox" & i) = "" Then (c'est cette ligne qui pose problème!)
MsgBox "Vous devez remplir le champ " & Controls("label" & i)
Controls("Textbox" & i).SetFocus
Exit For
End If
Next i
With shtjanvier
.Range("AB1") = txtParc.Value
.Range("AB2") = txtCodeParc.Value
.Range("AB3") = txtDirection.Value
.Range("B58") = txtResponsable.Value
.Range("F8") = txtPayant1.Value
.Range("H8") = txtPayant2.Value
.Range("J8") = txtPayant3.Value
.Range("M7") = txtNpayant1.Value
.Range("O7") = txtNpayant2.Value
.Range("Q7") = txtNpayant3.Value
.Range("S7") = txtNpayant4.Value
.Range("U7") = txtNpayant5.Value
.Range("W7") = txtNpayant6.Value
.Range("Y7") = txtNpayant7.Value
.Range("F4") = CboAnnee.Value
.Range("A9") = txtDate.Value
End With
Unload Me
End Sub
Ci-joint mon code
Voici le message d'erreur
Erreur d'éxécution -2147024809(80070057):
Objet spécifique introuvable
Merci pour votre aide.
Private Sub CmdValideInfoParc_Click()
Dim i As Byte
For i = 1 To 15
If Controls("TextBox" & i) = "" Then (c'est cette ligne qui pose problème!)
MsgBox "Vous devez remplir le champ " & Controls("label" & i)
Controls("Textbox" & i).SetFocus
Exit For
End If
Next i
With shtjanvier
.Range("AB1") = txtParc.Value
.Range("AB2") = txtCodeParc.Value
.Range("AB3") = txtDirection.Value
.Range("B58") = txtResponsable.Value
.Range("F8") = txtPayant1.Value
.Range("H8") = txtPayant2.Value
.Range("J8") = txtPayant3.Value
.Range("M7") = txtNpayant1.Value
.Range("O7") = txtNpayant2.Value
.Range("Q7") = txtNpayant3.Value
.Range("S7") = txtNpayant4.Value
.Range("U7") = txtNpayant5.Value
.Range("W7") = txtNpayant6.Value
.Range("Y7") = txtNpayant7.Value
.Range("F4") = CboAnnee.Value
.Range("A9") = txtDate.Value
End With
Unload Me
End Sub