Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Textbox sans valeur

2 réponses
Avatar
STEN
Bonjour, dans un usf j'ai trois textbox qui servent =E0=20
renseigner des cellules dans plusieurs feuilles, comment=20
afficher un message d'erreur si l'un des textbox ne=20
contient aucune valeur.
Le code de mon usf!
Merci
Private Sub CmdAnnul_Click()
Unload Me

End Sub

Private Sub CmdModif_Click()
If MsgBox("Vous allez supprimer les informations" & Chr
(13) _
& "sur l'identit=E9 de votre site!" & Chr(13) & Chr(10) &=20
Chr(10) _
& "=CAtes vous sur de vouloir continuer ?" _
, vbCritical + vbYesNo, PARAMETRES.Caption) =3D vbYes Then

ChangeParametreSite
MsgBox "Vous pouvez =E0 pr=E9sent entrer" & Chr(13) _
& "les nouvelles donn=E9es du site!", vbInformation,=20
PARAMETRES.Caption
Me.TxtNom.SetFocus

Else
Unload Me
=20
End If

End Sub

Private Sub CmdValid_Click()
JANVIER.Range("B3").Value =3D PARAMETRES.TxtNom.Value
JANVIER.Range("E3").Value =3D PARAMETRES.TxtCode.Value
JANVIER.Range("B5").Value =3D=20
PARAMETRES.TxtDepartement.Value

FEVRIER.Range("B3").Value =3D PARAMETRES.TxtNom.Value
FEVRIER.Range("E3").Value =3D PARAMETRES.TxtCode.Value
FEVRIER.Range("B5").Value =3D=20
PARAMETRES.TxtDepartement.Value

MARS.Range("B3").Value =3D PARAMETRES.TxtNom.Value
MARS.Range("E3").Value =3D PARAMETRES.TxtCode.Value
MARS.Range("B5").Value =3D PARAMETRES.TxtDepartement.Value

AVRIL.Range("B3").Value =3D PARAMETRES.TxtNom.Value
AVRIL.Range("E3").Value =3D PARAMETRES.TxtCode.Value
AVRIL.Range("B5").Value =3D PARAMETRES.TxtDepartement.Value

MAI.Range("B3").Value =3D PARAMETRES.TxtNom.Value
MAI.Range("E3").Value =3D PARAMETRES.TxtCode.Value
MAI.Range("B5").Value =3D PARAMETRES.TxtDepartement.Value

JUIN.Range("B3").Value =3D PARAMETRES.TxtNom.Value
JUIN.Range("E3").Value =3D PARAMETRES.TxtCode.Value
JUIN.Range("B5").Value =3D PARAMETRES.TxtDepartement.Value

JUILLET.Range("B3").Value =3D PARAMETRES.TxtNom.Value
JUILLET.Range("E3").Value =3D PARAMETRES.TxtCode.Value
JUILLET.Range("B5").Value =3D=20
PARAMETRES.TxtDepartement.Value

AOUT.Range("B3").Value =3D PARAMETRES.TxtNom.Value
AOUT.Range("E3").Value =3D PARAMETRES.TxtCode.Value
AOUT.Range("B5").Value =3D PARAMETRES.TxtDepartement.Value

SEPTEMBRE.Range("B3").Value =3D PARAMETRES.TxtNom.Value
SEPTEMBRE.Range("E3").Value =3D PARAMETRES.TxtCode.Value
SEPTEMBRE.Range("B5").Value =3D=20
PARAMETRES.TxtDepartement.Value

OCTOBRE.Range("B3").Value =3D PARAMETRES.TxtNom.Value
OCTOBRE.Range("E3").Value =3D PARAMETRES.TxtCode.Value
OCTOBRE.Range("B5").Value =3D=20
PARAMETRES.TxtDepartement.Value

NOVEMBRE.Range("B3").Value =3D PARAMETRES.TxtNom.Value
NOVEMBRE.Range("E3").Value =3D PARAMETRES.TxtCode.Value
NOVEMBRE.Range("B5").Value =3D=20
PARAMETRES.TxtDepartement.Value

DECEMBRE.Range("B3").Value =3D PARAMETRES.TxtNom.Value
DECEMBRE.Range("E3").Value =3D PARAMETRES.TxtCode.Value
DECEMBRE.Range("B5").Value =3D=20
PARAMETRES.TxtDepartement.Value

SYNTHESE.Range("B3").Value =3D PARAMETRES.TxtNom.Value
SYNTHESE.Range("E3").Value =3D PARAMETRES.TxtCode.Value
SYNTHESE.Range("B5").Value =3D=20
PARAMETRES.TxtDepartement.Value

If Me.TxtNom.Value =3D "" Then
MsgBox "Vous devez taper un nom de site!", vbInformation,=20
_
PARAMETRES.Caption
Me.TxtNom.SetFocus
End If


Unload Me
End Sub

Private Sub UserForm_Initialize()
Me.StartUpPosition =3D 2
Me.TxtNom.SetFocus

End Sub

2 réponses

Avatar
michdenis
Bonjour Sten,

Tu pourrais avoir une procédure de ce type :

Remplace dans la procédure, le nom des textbox par ceux de ton application

'--------------------------
Private Sub CommandButton1_Click()

Dim Arr(), A As Integer
Arr = Array("Textbox1", "Textbox2", "Textbox3")

For A = 0 To UBound(Arr)
If Me.Controls(Arr(A)) = "" Then
MsgBox Me.Controls(Arr(A)).Name & " est vide"
Me.Controls(Arr(A)).SetFocus
Exit Sub
End If
Next
End Sub
'--------------------------


Salutations!



"STEN" a écrit dans le message de news:73df01c43068$51b51350$
Bonjour, dans un usf j'ai trois textbox qui servent à
renseigner des cellules dans plusieurs feuilles, comment
afficher un message d'erreur si l'un des textbox ne
contient aucune valeur.
Le code de mon usf!
Merci
Private Sub CmdAnnul_Click()
Unload Me

End Sub

Private Sub CmdModif_Click()
If MsgBox("Vous allez supprimer les informations" & Chr
(13) _
& "sur l'identité de votre site!" & Chr(13) & Chr(10) &
Chr(10) _
& "Êtes vous sur de vouloir continuer ?" _
, vbCritical + vbYesNo, PARAMETRES.Caption) = vbYes Then

ChangeParametreSite
MsgBox "Vous pouvez à présent entrer" & Chr(13) _
& "les nouvelles données du site!", vbInformation,
PARAMETRES.Caption
Me.TxtNom.SetFocus

Else
Unload Me

End If

End Sub

Private Sub CmdValid_Click()
JANVIER.Range("B3").Value = PARAMETRES.TxtNom.Value
JANVIER.Range("E3").Value = PARAMETRES.TxtCode.Value
JANVIER.Range("B5").Value PARAMETRES.TxtDepartement.Value

FEVRIER.Range("B3").Value = PARAMETRES.TxtNom.Value
FEVRIER.Range("E3").Value = PARAMETRES.TxtCode.Value
FEVRIER.Range("B5").Value PARAMETRES.TxtDepartement.Value

MARS.Range("B3").Value = PARAMETRES.TxtNom.Value
MARS.Range("E3").Value = PARAMETRES.TxtCode.Value
MARS.Range("B5").Value = PARAMETRES.TxtDepartement.Value

AVRIL.Range("B3").Value = PARAMETRES.TxtNom.Value
AVRIL.Range("E3").Value = PARAMETRES.TxtCode.Value
AVRIL.Range("B5").Value = PARAMETRES.TxtDepartement.Value

MAI.Range("B3").Value = PARAMETRES.TxtNom.Value
MAI.Range("E3").Value = PARAMETRES.TxtCode.Value
MAI.Range("B5").Value = PARAMETRES.TxtDepartement.Value

JUIN.Range("B3").Value = PARAMETRES.TxtNom.Value
JUIN.Range("E3").Value = PARAMETRES.TxtCode.Value
JUIN.Range("B5").Value = PARAMETRES.TxtDepartement.Value

JUILLET.Range("B3").Value = PARAMETRES.TxtNom.Value
JUILLET.Range("E3").Value = PARAMETRES.TxtCode.Value
JUILLET.Range("B5").Value PARAMETRES.TxtDepartement.Value

AOUT.Range("B3").Value = PARAMETRES.TxtNom.Value
AOUT.Range("E3").Value = PARAMETRES.TxtCode.Value
AOUT.Range("B5").Value = PARAMETRES.TxtDepartement.Value

SEPTEMBRE.Range("B3").Value = PARAMETRES.TxtNom.Value
SEPTEMBRE.Range("E3").Value = PARAMETRES.TxtCode.Value
SEPTEMBRE.Range("B5").Value PARAMETRES.TxtDepartement.Value

OCTOBRE.Range("B3").Value = PARAMETRES.TxtNom.Value
OCTOBRE.Range("E3").Value = PARAMETRES.TxtCode.Value
OCTOBRE.Range("B5").Value PARAMETRES.TxtDepartement.Value

NOVEMBRE.Range("B3").Value = PARAMETRES.TxtNom.Value
NOVEMBRE.Range("E3").Value = PARAMETRES.TxtCode.Value
NOVEMBRE.Range("B5").Value PARAMETRES.TxtDepartement.Value

DECEMBRE.Range("B3").Value = PARAMETRES.TxtNom.Value
DECEMBRE.Range("E3").Value = PARAMETRES.TxtCode.Value
DECEMBRE.Range("B5").Value PARAMETRES.TxtDepartement.Value

SYNTHESE.Range("B3").Value = PARAMETRES.TxtNom.Value
SYNTHESE.Range("E3").Value = PARAMETRES.TxtCode.Value
SYNTHESE.Range("B5").Value PARAMETRES.TxtDepartement.Value

If Me.TxtNom.Value = "" Then
MsgBox "Vous devez taper un nom de site!", vbInformation,
_
PARAMETRES.Caption
Me.TxtNom.SetFocus
End If


Unload Me
End Sub

Private Sub UserForm_Initialize()
Me.StartUpPosition = 2
Me.TxtNom.SetFocus

End Sub
Avatar
STEN
-----Message d'origine-----
Bonjour Sten,

Tu pourrais avoir une procédure de ce type :

Remplace dans la procédure, le nom des textbox par ceux
de ton application


'--------------------------
Private Sub CommandButton1_Click()

Dim Arr(), A As Integer
Arr = Array("Textbox1", "Textbox2", "Textbox3")

For A = 0 To UBound(Arr)
If Me.Controls(Arr(A)) = "" Then
MsgBox Me.Controls(Arr(A)).Name & " est vide"
Me.Controls(Arr(A)).SetFocus
Exit Sub
End If
Next
End Sub
'--------------------------


Salutations!



"STEN" a écrit dans le message de
news:73df01c43068$51b51350$

Bonjour, dans un usf j'ai trois textbox qui servent à
renseigner des cellules dans plusieurs feuilles, comment
afficher un message d'erreur si l'un des textbox ne
contient aucune valeur.
Le code de mon usf!
Merci
Private Sub CmdAnnul_Click()
Unload Me

End Sub

Private Sub CmdModif_Click()
If MsgBox("Vous allez supprimer les informations" & Chr
(13) _
& "sur l'identité de votre site!" & Chr(13) & Chr(10) &
Chr(10) _
& "Êtes vous sur de vouloir continuer ?" _
, vbCritical + vbYesNo, PARAMETRES.Caption) = vbYes Then

ChangeParametreSite
MsgBox "Vous pouvez à présent entrer" & Chr(13) _
& "les nouvelles données du site!", vbInformation,
PARAMETRES.Caption
Me.TxtNom.SetFocus

Else
Unload Me

End If

End Sub

Private Sub CmdValid_Click()
JANVIER.Range("B3").Value = PARAMETRES.TxtNom.Value
JANVIER.Range("E3").Value = PARAMETRES.TxtCode.Value
JANVIER.Range("B5").Value =
PARAMETRES.TxtDepartement.Value

FEVRIER.Range("B3").Value = PARAMETRES.TxtNom.Value
FEVRIER.Range("E3").Value = PARAMETRES.TxtCode.Value
FEVRIER.Range("B5").Value =
PARAMETRES.TxtDepartement.Value

MARS.Range("B3").Value = PARAMETRES.TxtNom.Value
MARS.Range("E3").Value = PARAMETRES.TxtCode.Value
MARS.Range("B5").Value = PARAMETRES.TxtDepartement.Value

AVRIL.Range("B3").Value = PARAMETRES.TxtNom.Value
AVRIL.Range("E3").Value = PARAMETRES.TxtCode.Value
AVRIL.Range("B5").Value = PARAMETRES.TxtDepartement.Value

MAI.Range("B3").Value = PARAMETRES.TxtNom.Value
MAI.Range("E3").Value = PARAMETRES.TxtCode.Value
MAI.Range("B5").Value = PARAMETRES.TxtDepartement.Value

JUIN.Range("B3").Value = PARAMETRES.TxtNom.Value
JUIN.Range("E3").Value = PARAMETRES.TxtCode.Value
JUIN.Range("B5").Value = PARAMETRES.TxtDepartement.Value

JUILLET.Range("B3").Value = PARAMETRES.TxtNom.Value
JUILLET.Range("E3").Value = PARAMETRES.TxtCode.Value
JUILLET.Range("B5").Value =
PARAMETRES.TxtDepartement.Value

AOUT.Range("B3").Value = PARAMETRES.TxtNom.Value
AOUT.Range("E3").Value = PARAMETRES.TxtCode.Value
AOUT.Range("B5").Value = PARAMETRES.TxtDepartement.Value

SEPTEMBRE.Range("B3").Value = PARAMETRES.TxtNom.Value
SEPTEMBRE.Range("E3").Value = PARAMETRES.TxtCode.Value
SEPTEMBRE.Range("B5").Value =
PARAMETRES.TxtDepartement.Value

OCTOBRE.Range("B3").Value = PARAMETRES.TxtNom.Value
OCTOBRE.Range("E3").Value = PARAMETRES.TxtCode.Value
OCTOBRE.Range("B5").Value =
PARAMETRES.TxtDepartement.Value

NOVEMBRE.Range("B3").Value = PARAMETRES.TxtNom.Value
NOVEMBRE.Range("E3").Value = PARAMETRES.TxtCode.Value
NOVEMBRE.Range("B5").Value =
PARAMETRES.TxtDepartement.Value

DECEMBRE.Range("B3").Value = PARAMETRES.TxtNom.Value
DECEMBRE.Range("E3").Value = PARAMETRES.TxtCode.Value
DECEMBRE.Range("B5").Value =
PARAMETRES.TxtDepartement.Value

SYNTHESE.Range("B3").Value = PARAMETRES.TxtNom.Value
SYNTHESE.Range("E3").Value = PARAMETRES.TxtCode.Value
SYNTHESE.Range("B5").Value =
PARAMETRES.TxtDepartement.Value

If Me.TxtNom.Value = "" Then
MsgBox "Vous devez taper un nom de site!", vbInformation,
_
PARAMETRES.Caption
Me.TxtNom.SetFocus
End If


Unload Me
End Sub

Private Sub UserForm_Initialize()
Me.StartUpPosition = 2
Me.TxtNom.SetFocus

End Sub



.Merci c'est tout a fait ce que je voulais!