VBA - INPUTBOx
Résolu/Fermé
Tehani_t
Messages postés
240
Date d'inscription
mercredi 14 juillet 2010
Statut
Membre
Dernière intervention
20 décembre 2011
-
20 juil. 2010 à 20:46
Tehani_t Messages postés 240 Date d'inscription mercredi 14 juillet 2010 Statut Membre Dernière intervention 20 décembre 2011 - 24 août 2010 à 22:28
Tehani_t Messages postés 240 Date d'inscription mercredi 14 juillet 2010 Statut Membre Dernière intervention 20 décembre 2011 - 24 août 2010 à 22:28
A voir également:
- Inputbox vba plusieurs entrées
- Vba attendre 1 seconde ✓ - Forum VB / VBA
- Incompatibilité de type vba ✓ - Forum Programmation
- Inputbox vba - Astuces et Solutions
- Vba dernière colonne non vide ✓ - Forum VB / VBA
- Vba récupérer valeur cellule ✓ - Forum VB / VBA
3 réponses
f894009
Messages postés
17181
Date d'inscription
dimanche 25 novembre 2007
Statut
Membre
Dernière intervention
21 mars 2024
1 701
22 juil. 2010 à 11:13
22 juil. 2010 à 11:13
Bonjour,
Sub controle_saisie_mat()
'------------------------------------------------------------------------------------------------
'CONTROLE DE SAISIE SUR MATRICULE = NUMERIQUE
'------------------------------------------------------------------------------------------------
Do
matricule = InputBox("Saisir le matricule", "Controle de saisie", "18183")
'Sortie du module si click sur annuler
If vbCancel Then Exit Do
If Not IsNumeric(matricule) Then
MsgBox ("Une valeur numérique est requise !")
End If
Loop Until IsNumeric(matricule)
End Sub
J'espere que cela vous conviendra.
Sub controle_saisie_mat()
'------------------------------------------------------------------------------------------------
'CONTROLE DE SAISIE SUR MATRICULE = NUMERIQUE
'------------------------------------------------------------------------------------------------
Do
matricule = InputBox("Saisir le matricule", "Controle de saisie", "18183")
'Sortie du module si click sur annuler
If vbCancel Then Exit Do
If Not IsNumeric(matricule) Then
MsgBox ("Une valeur numérique est requise !")
End If
Loop Until IsNumeric(matricule)
End Sub
J'espere que cela vous conviendra.
Tehani_t
Messages postés
240
Date d'inscription
mercredi 14 juillet 2010
Statut
Membre
Dernière intervention
20 décembre 2011
21
20 juil. 2010 à 20:59
20 juil. 2010 à 20:59
Sub controle_saisie_mat()
'------------------------------------------------------------------------------------------------
'CONTROLE DE SAISIE SUR MATRICULE = NUMERIQUE
'------------------------------------------------------------------------------------------------
Do
matricule = InputBox("Saisir le matricule", "Controle de saisie", "18183")
If Not IsNumeric(matricule) Then
MsgBox ("Une valeur numérique est requise !")
End If
Loop Until IsNumeric(matricule)
End Sub
Sub matricule_existe()
'------------------------------------------------------------------------------------------------
'VERIFIE L'EXISTENCE DU MATRICULE
'------------------------------------------------------------------------------------------------
nb_ligne = ActiveSheet.UsedRange.Rows.Count
i = 2
n = 0
'Boucle qui parcourre les lignes de la premiere colonne pour vérifier l'existence du matricule
Do
i = i + 1
val = Sheets(num_feuil).Cells(i, 1).Value
If val = matricule Then
MsgBox ("Le matricule existe bien")
n = 1
End If
Loop Until n = 1 Or i > nb_ligne
'Affiche un message si le matricule est inexistant
If n = 0 Then
MsgBox ("Le matricule n'existe pas !")
End If
End Sub
Private Sub bt_note_Click()
'------------------------------------------------------------------------------------------------
'SELECTION FEUILLE NOTATION ET LIGNE DU MATRICULE SAISI
'------------------------------------------------------------------------------------------------
matricule = 0
num_feuil = 0
controle_saisie_mat
num_feuil = 7
matricule_existe
'Si le matricule est inexistant alors on reste sur la "Feuil agent"
If n <> 0 Then
Worksheets(num_feuil).Select
ActiveSheet.UsedRange.Rows(i).Select
Else
Worksheets("agent").Select
End If
End Sub
'------------------------------------------------------------------------------------------------
'CONTROLE DE SAISIE SUR MATRICULE = NUMERIQUE
'------------------------------------------------------------------------------------------------
Do
matricule = InputBox("Saisir le matricule", "Controle de saisie", "18183")
If Not IsNumeric(matricule) Then
MsgBox ("Une valeur numérique est requise !")
End If
Loop Until IsNumeric(matricule)
End Sub
Sub matricule_existe()
'------------------------------------------------------------------------------------------------
'VERIFIE L'EXISTENCE DU MATRICULE
'------------------------------------------------------------------------------------------------
nb_ligne = ActiveSheet.UsedRange.Rows.Count
i = 2
n = 0
'Boucle qui parcourre les lignes de la premiere colonne pour vérifier l'existence du matricule
Do
i = i + 1
val = Sheets(num_feuil).Cells(i, 1).Value
If val = matricule Then
MsgBox ("Le matricule existe bien")
n = 1
End If
Loop Until n = 1 Or i > nb_ligne
'Affiche un message si le matricule est inexistant
If n = 0 Then
MsgBox ("Le matricule n'existe pas !")
End If
End Sub
Private Sub bt_note_Click()
'------------------------------------------------------------------------------------------------
'SELECTION FEUILLE NOTATION ET LIGNE DU MATRICULE SAISI
'------------------------------------------------------------------------------------------------
matricule = 0
num_feuil = 0
controle_saisie_mat
num_feuil = 7
matricule_existe
'Si le matricule est inexistant alors on reste sur la "Feuil agent"
If n <> 0 Then
Worksheets(num_feuil).Select
ActiveSheet.UsedRange.Rows(i).Select
Else
Worksheets("agent").Select
End If
End Sub
Tehani_t
Messages postés
240
Date d'inscription
mercredi 14 juillet 2010
Statut
Membre
Dernière intervention
20 décembre 2011
21
24 août 2010 à 22:28
24 août 2010 à 22:28
Merci !