VBA - INPUTBOx
Résolu
Tehani_t
Messages postés
240
Date d'inscription
Statut
Membre
Dernière intervention
-
Tehani_t Messages postés 240 Date d'inscription Statut Membre Dernière intervention -
Tehani_t Messages postés 240 Date d'inscription Statut Membre Dernière intervention -
A voir également:
- Vba input box
- Set-top box - Accueil - Box & Connexion Internet
- Adresse ip box - Guide
- Tera box - Télécharger - Stockage
- Input signal not found ✓ - Forum Matériel & Système
- Input not supported - Forum Ecran
3 réponses
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.
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