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 :

Modification du formulaire ne fonctionne pas Merci de m'apporter d'aide


Sujet :

Macros et VBA Excel

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre très actif
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2013
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Janvier 2013
    Messages : 377
    Par défaut Modification du formulaire ne fonctionne pas Merci de m'apporter d'aide
    Bonjour tout le monde , je suis entrain de coder un bouton pour modifier mon tableau excel via un formulaire, mais je n'arrive pas à récupérer les lignes de tableau dans le formulaire et ainsi les modifier voici mon code Merci de me montrer où est ma faute...
    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
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    Private Sub ComboBoxGDO_Change()
    'Dim cell As Range
    'Dim cherch As String, derlign As Long
    'derlign = Sheets("Remplissage").Range("A65536").End(xlUp).Row
    'cherch = ComboBoxGDO
    'Set cell = Sheets("Remplissage").Range("A3:AC" & derlign).Find(cherch, lookat:=xlWhole)
      'If Not cell Is Nothing Then
        'Ligne = cell.Row
        If ComboBoxGDO.ListIndex > -1 Then
        Ligne = ComboBoxGDO.ListIndex + 3
        TextHTA.Value = Range("A" & Ligne)
        TextNom.Value = Range("B" & Ligne)
        TextExploit.Value = Range("C" & Ligne)
        ComboBoxGDO.Value = Range("D" & Ligne)
        ComboBoxPPI.Value = Range("E" & Ligne)
        TextPoste.Value = Range("F" & Ligne).Value
        TextCommune.Value = Range("G" & Ligne).Value
        ComboBoxModèle.Value = Range("H" & Ligne)
        ComboBoxConstructeur.Value = Range("I" & Ligne)
        ComboBoxTechnologie.Value = Range("J" & Ligne)
        ComboBoxTypeILD.Value = Range("K" & Ligne)
        ComboBoxAnnéeBatterie.Value = Range("L" & Ligne)
        TextCalibrePossible.Value = Range("M" & Ligne)
        TextRéglageEffectif.Value = Range("N" & Ligne)
        TextRéglagePréconisé.Value = Range("O" & Ligne)
        ComboBoxDateControle.Value = Range("P" & Ligne)
        ComboBoxAnnéeControleValise.Value = Range("Q" & Ligne)
        TextGéocutil.Value = Range("R" & Ligne)
        TextTerrain.Value = Range("S" & Ligne)
        ComboBoxBatterie.Value = Range("T" & Ligne)
        ComboBoxPlatine.Value = Range("U" & Ligne)
        ComboBoxVoyant.Value = Range("V" & Ligne)
        ComboBoxTorres.Value = Range("W" & Ligne)
        ComboBoxModificationSchémas.Value = Range("X" & Ligne)
        TextContenuACR.Value = Range("Y" & Ligne)
        TextActionVisite.Value = Range("Z" & Ligne)
        TextActionUltérieurement.Value = Range("AA" & Ligne)
        ComboBoxSiteOpérationnel.Value = Range("AB" & Ligne)
        ComboBoxRésultat.Value = Range("AC" & Ligne)
      End If
    End Sub
     
    Private Sub CommandButtonModifier_Click()
        If Formulaire1.TextHTA.Text = "" Then
           MsgBox "Vous devez entrer le code départ HTA."
           Formulaire1.TextHTA.SetFocus
        Exit Sub
        End If
        If Formulaire1.TextNom.Text = "" Then
           MsgBox "Vous devez entrer le nom du départ HTA."
           Formulaire1.TextNom.SetFocus
        Exit Sub
        End If
        If Formulaire1.TextExploit.Text = "" Then
           MsgBox "Vous devez entrer le pôle exploitation."
           Formulaire1.TextExploit.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxGDO.Text = "" Then
           MsgBox "Vous devez entrer le code GDO."
           Formulaire1.ComboBoxGDO.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxPPI.Text = "" Then
           MsgBox "Vous devez entrer le rang de PPI."
           Formulaire1.ComboBoxPPI.SetFocus
        Exit Sub
        End If
     
        If Formulaire1.TextPoste.Text = "" Then
           MsgBox "Vous devez entrer le nom du poste."
           Formulaire1.TextPoste.SetFocus
        Exit Sub
        End If
        If Formulaire1.TextCommune.Text = "" Then
            MsgBox "Vous devez entrer le nom de la commune."
            Formulaire1.TextCommune.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxModèle.Text = "" Then
           MsgBox "Vous devez entrer le modèle de L'ILD."
           Formulaire1.ComboBoxModèle.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxConstructeur.Text = "" Then
           MsgBox "Vous devez entrer le nom du constructeur."
           Formulaire1.ComboBoxConstructeur.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxTechnologie.Text = "" Then
           MsgBox "Vous devez entrer la technologie de L'ILD."
           Formulaire1.ComboBoxTechnologie.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxTypeILD.Text = "" Then
           MsgBox "Vous devez entrer le Type de l'ILD."
           Formulaire1.TypeILD.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxAnnéeBatterie.Text = "" Then
           MsgBox "Vous devez entrer l'année de la fabrication de la batterie."
           Formulaire1.ComboBoxAnnéeBatterie.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxDateControle.Text = "" Then
           MsgBox "Vous devez entrer la date de contrôle de l'ILD."
           Formulaire1.ComboBoxDateControle.SetFocus
        Exit Sub
        End If
        If Formulaire1.TextGéocutil.Text = "" Then
           MsgBox "Vous devez entrer l'ILD présent coté (sur le schémas Géocutil)."
           Formulaire1.TextGéocutil.SetFocus
        Exit Sub
        End If
        If Formulaire1.TextTerrain.Text = "" Then
           MsgBox "Vous devez entrer l'ILD présent coté (sur le terrain)."
           Formulaire1.TextTerrain.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxBatterie.Text = "" Then
           MsgBox "Vous devez entrer l'etat de la batterie."
           Formulaire1.ComboBoxBatterie.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxPlatine.Text = "" Then
           MsgBox "Vous devez entrer l'état de la platine."
           Formulaire1.ComboBoxPlatine.SetFocus
        Exit Sub
        End If
          If Formulaire1.ComboBoxVoyant = "" Then
           MsgBox "Vous devez entrer l'état du voyant."
           Formulaire1.ComboBoxVoyant.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxTorres.Text = "" Then
           MsgBox "Vous devez entrer l'état des torres."
           Formulaire1.ComboBoxTorres.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxModificationSchémas.Text = "" Then
           MsgBox "Vous devez signaler si le schéma ACR est à modifier ?."
           Formulaire1.ComboBoxModificationSchémas.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxSiteOpérationnel.Text = "" Then
           MsgBox "Vous devez entrer le site opérationnel."
           Formulaire1.ComboBoxSiteOpérationnel.SetFocus
        Exit Sub
        End If
        If Formulaire1.ComboBoxRésultat.Text = "" Then
           MsgBox "Vous devez signaler le résultat de contrôle de l'ILD."
           Formulaire1.ComboBoxRésultat.SetFocus
        Exit Sub
        End If
        If Formulaire1.TextActionUltérieurement.Text = "" Then
           MsgBox "Vous devez signaler le résultat de contrôle de l'ILD."
           Formulaire1.TextActionUltérieurement.SetFocus
        Exit Sub
        End If
        If Formulaire1.TextActionVisite.Text = "" Then
           MsgBox "Vous devez signaler le résultat de contrôle de l'ILD."
           Formulaire1.TextActionVisite.SetFocus
        Exit Sub
        End If
    Dim Ctrl As Control
    Dim Colonne As Integer
    Dim Ligne As Long
     
      If Me.ComboBoxGDO.ListIndex = -1 Then Exit Sub
      Ligne = Me.ComboBoxGDO.ListIndex + 3
    With Sheets("Remplissage")
    .Range("A" & Ligne).Value = TextHTA
    .Range("B" & Ligne).Value = TextNom
    .Range("C" & Ligne).Value = TextExploit
    .Range("D" & Ligne).Value = ComboBoxGDO
    .Range("E" & Ligne).Value = Formulaire1.ComboBoxPPI
    .Range("F" & Ligne).Value = TextPoste
    .Range("G" & Ligne).Value = TextCommune
    .Range("H" & Ligne).Value = Formulaire1.ComboBoxModèle
    .Range("I" & Ligne).Value = Formulaire1.ComboBoxConstructeur
    .Range("J" & Ligne).Value = Formulaire1.ComboBoxTechnologie
    .Range("K" & Ligne).Value = Formulaire1.ComboBoxTypeILD
    .Range("L" & Ligne).Value = Formulaire1.ComboBoxAnnéeBatterie
    .Range("M" & Ligne).Value = TextCalibrePossible.Value
    .Range("N" & Ligne).Value = TextRéglageEffectif.Value
    .Range("O" & Ligne).Value = TextRéglagePréconisé.Value
    .Range("P" & Ligne).Value = Formulaire1.ComboBoxDateControle
    .Range("Q" & Ligne).Value = Formulaire1.ComboBoxAnnéeControleValise
    .Range("R" & Ligne).Value = TextGéocutil.Value
    .Range("S" & Ligne).Value = TextTerrain.Value
    .Range("T" & Ligne).Value = Formulaire1.ComboBoxBatterie
    .Range("U" & Ligne).Value = Formulaire1.ComboBoxPlatine
    .Range("V" & Ligne).Value = Formulaire1.ComboBoxVoyant
    .Range("W" & Ligne).Value = Formulaire1.ComboBoxTorres
    .Range("X" & Ligne).Value = Formulaire1.ComboBoxModificationSchémas
    .Range("Y" & Ligne).Value = TextContenuACR.Value
    .Range("Z" & Ligne).Value = TextActionVisite.Value
    .Range("AA" & Ligne).Value = TextActionUltérieurement.Value
    .Range("AB" & Ligne).Value = Formulaire1.ComboBoxSiteOpérationnel
    .Range("AC" & Ligne).Value = Formulaire1.ComboBoxRésultat
     
    End With
    End If
    Me.TextHTA = ""
    Me.TextNom = ""
    Me.TextExploit = ""
    Me.ComboBoxGDO = ""
    Me.TextPoste = ""
    Me.TextCommune = ""
    Me.ComboBoxAnnéeBatterie = ""
    Me.ComboBoxAnnéeControleValise = ""
    Me.TextCalibrePossible = ""
    Me.TextRéglageEffectif = ""
    Me.TextRéglagePréconisé = ""
    Me.ComboBoxDateControle = ""
    Me.TextGéocutil = ""
    Me.ComboBoxModificationSchémas = ""
    Me.TextContenuACR = ""
    Me.TextActionVisite = ""
    Me.TextActionUltérieurement = ""
    Me.ComboBoxSiteOpérationnel = ""
    Me.ComboBoxBatterie = ""
    Me.ComboBoxTorres = ""
    Me.ComboBoxConstructeur = ""
    Me.ComboBoxModèle = ""
    Me.ComboBoxPlatine = ""
    Me.ComboBoxPPI = ""
    Me.ComboBoxRésultat = ""
    Me.ComboBoxTechnologie = ""
    Me.ComboBoxTypeILD = ""
    Me.ComboBoxVoyant = ""
    End Sub

  2. #2
    Inactif  
    Homme Profil pro
    Inscrit en
    Septembre 2012
    Messages
    1 733
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2012
    Messages : 1 733
    Par défaut
    les premières lignes ne doivent pas être commentées, il te faut l'index Ligne.

    Sinon si tu nous expliques ou plante ton code ça ira plus vite

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

Discussions similaires

  1. Mon formulaire ne fonctionne pas
    Par misslinoa dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 22/02/2008, 14h38
  2. envoi formulaire ne fonctionne pas
    Par isarno dans le forum Dreamweaver
    Réponses: 7
    Dernier message: 06/12/2007, 22h44
  3. Réponses: 3
    Dernier message: 19/09/2007, 13h09
  4. Requête modif dans formulaire ne marche pas
    Par crissud dans le forum IHM
    Réponses: 2
    Dernier message: 12/04/2007, 10h31
  5. [MySQL] Redirection après formulaire ne fonctionne pas
    Par Solexensolo dans le forum PHP & Base de données
    Réponses: 10
    Dernier message: 06/12/2006, 13h46

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