IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Macros et VBA Excel Discussion :

Ajout d'une checkbox ainsi que de son code [XL-2003]


Sujet :

Macros et VBA Excel

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    165
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 165
    Points : 62
    Points
    62
    Par défaut Ajout d'une checkbox ainsi que de son code
    Bonjour,

    Pouvez-vous m'aider afin de modifier ce code ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    Private Sub CommandButton1_Click()
    Dim StrMessage
    If CheckBox3.Value = True Then
    MsgBox "La fonction - Rapport - n'est pas encore disponible", vbInformation + vbOKOnly, "Information"
    End If
        If CheckBox2.Value = True Then
            If OptionButton1.Value = True Then
                Repartition_Jour_Tous
                Tableau_Analyse
     
            ElseIf OptionButton2.Value = True Then
                Repartition_Jour
                Tableau_Analyse
     
            ElseIf OptionButton3.Value = True Then
                Repartition_Jour_1
                Tableau_Analyse
            Else
                Tableau_Analyse
            End If
        Else
            If OptionButton1.Value = True Then
                Repartition_Jour_Tous
     
            ElseIf OptionButton2.Value = True Then
                Repartition_Jour
     
            ElseIf OptionButton3.Value = True Then
                Repartition_Jour_1
     
            Else
                MsgBox "Aucune case sélectionnée", vbInformation + vbOKOnly, "Information"
            End If
        End If
     Unload UserForm1
    End Sub
    Le UserForm1 est composé de trois OptionButton, ainsi que de deux checkbox.

    Je veux ajouter la fonction qui est attribué à la checkbox3. (La macro qui devrait y être attaché se nomme (Rapport_Jour).

    Cependant, cette Macro fonctionne à partir d'un tableau qui se créer à partir des données existantes dans les différences sheets de travail, c'est à dire qu'il y a un sens dans les opérations.

    D'abord les options buttons, ensuite la checkbox2 qui déclanche la construction d'un tableau et pour finir la checkbox3 qui créer un rapport à partir du tableau.

    Comment je peux créer cela ? En sachant que les checkbox ne sont pas obligatoire, d'oú le choix de checkbox.

    Merci d'avance

    Pour rappel, la macro qui se déclanche lorsqu'on check la box 3 est "Rapport_Jour". Donc il faut remplacer "MsgBox "La fonction - Rapport - n'est pas encore disponible", vbInformation + vbOKOnly, "Information""

    Merci d'avance

    Bàv,

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    165
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 165
    Points : 62
    Points
    62
    Par défaut
    Je pense avoir trouvé la solution :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    Private Sub CommandButton1_Click()
    Dim StrMessage
        If CheckBox2.Value = True And CheckBox3.Value = True Then
            If OptionButton1.Value = True Then
                Repartition_Jour_Tous
                Tableau_Analyse
                Rapport_Jour
     
            ElseIf OptionButton2.Value = True Then
                Repartition_Jour
                Tableau_Analyse
                Rapport_Jour
     
            ElseIf OptionButton3.Value = True Then
                Repartition_Jour_1
                Tableau_Analyse
                Rapport_Jour
            Else
                Tableau_Analyse
                Rapport_Jour
            End If
     
        Else
     
        If CheckBox2.Value = True Then
            If OptionButton1.Value = True Then
                Repartition_Jour_Tous
                Tableau_Analyse
     
     
            ElseIf OptionButton2.Value = True Then
                Repartition_Jour
                Tableau_Analyse
     
     
            ElseIf OptionButton3.Value = True Then
                Repartition_Jour_1
                Tableau_Analyse
     
            Else
                Tableau_Analyse
     
            End If
     
            Else
     
        If CheckBox3.Value = True Then
            If OptionButton1.Value = True Then
                Repartition_Jour_Tous
                Rapport_Jour
     
     
            ElseIf OptionButton2.Value = True Then
                Repartition_Jour
                Rapport_Jour
     
     
            ElseIf OptionButton3.Value = True Then
                Repartition_Jour_1
                Rapport_Jour
     
            Else
                Rapport_Jour
     
            End If
     
        Else
            If OptionButton1.Value = True Then
                Repartition_Jour_Tous
     
            ElseIf OptionButton2.Value = True Then
                Repartition_Jour
     
            ElseIf OptionButton3.Value = True Then
                Repartition_Jour_1
     
            Else
                MsgBox "Aucune case sélectionnée", vbInformation + vbOKOnly, "Information"
            End If
            End If
            End If
     
        End If
     Unload UserForm1
    End Sub

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Ajout d'une checkbox dans une datawindow
    Par cradleofpain dans le forum Powerbuilder
    Réponses: 2
    Dernier message: 23/04/2007, 09h23
  2. cocher une checkbox en fonction de son nom
    Par boss_gama dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 08/09/2006, 16h42
  3. Réponses: 4
    Dernier message: 23/04/2006, 10h36
  4. Réponses: 2
    Dernier message: 19/02/2006, 12h46
  5. [VB.NET] Ajout d'une CheckBox à un DataSet
    Par graphicsxp dans le forum Windows Forms
    Réponses: 10
    Dernier message: 12/04/2005, 11h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo