sheep300
Messages postés29Date d'inscriptionvendredi 11 mai 2007StatutMembreDernière intervention 7 juillet 2013
-
11 juin 2008 à 08:42
sheep300
Messages postés29Date d'inscriptionvendredi 11 mai 2007StatutMembreDernière intervention 7 juillet 2013
-
11 juin 2008 à 10:42
bonjour en VBA
je doit valider un code pour afficher un document excel confidentiel
je voudrait qu'une fois le code valider la userform ce ferme et laisse le document excel ouvert
je n'y arrive pas
voila le code
Private Sub OK_Click()
If TextBox1 = 286143 Then
Sheets("Plan d'action associé").Visible = xlSheetVisible
Sheets("STEPHANIE").Visible = xlSheetVisible
Sheets("ISABELLE").Visible = xlSheetVisible
Sheets("AURELIE").Visible = xlSheetVisible
Sheets("RAPHAEL").Visible = xlSheetVisible
GoTo 2
End If
If TextBox1 = 542639 Then
Sheets("Plan d'action associé").Visible = xlSheetVisible
Sheets("STEPHANIE").Visible = xlSheetVisible
GoTo 2
End If
If TextBox1 = 466932 Then
Sheets("Plan d'action associé").Visible = xlSheetVisible
Sheets("ISABELLE").Visible = xlSheetVisible
GoTo 2
End If
If TextBox1 = 924623 Then
Sheets("Plan d'action associé").Visible = xlSheetVisible
Sheets("AURELIE").Visible = xlSheetVisible
GoTo 2
End If
If TextBox1 = 148625 Then
Sheets("Plan d'action associé").Visible = xlSheetVisible
Sheets("STEPHANIE").Visible = xlSheetVisible
Sheets("ISABELLE").Visible = xlSheetVisible
Sheets("AURELIE").Visible = xlSheetVisible
Sheets("RAPHAEL").Visible = xlSheetVisible
GoTo 2
End If
MsgBox "code incorect"
2
unload code
mortalino
Messages postés6786Date d'inscriptionvendredi 16 décembre 2005StatutMembreDernière intervention21 décembre 201118 11 juin 2008 à 10:03
select case, c'es un peu le If, elseif, end if.
Select Case Ton Objet ou Ta Variable
Case "abc"
Ici ça fait les instruction QUE si Ton Objet ou Ta Variable vaut abc
Case "ce que tu veux"
Ici ça fait les instruction QUE si Ton Objet ou Ta Variable vaut "ce que tu veux"
Case Else
Ici ça fait les instruction QUE si Ton Objet ou Ta Variable NE vaut aucunes des autres valeurs Case
Pour Unload Me, vu qu'in est dans l'objet UserForm, on peut employer Me.
Tape Me. après le point, tu verras toutes les méthodes et propriétés du User