Formulaire , bouton modifer ne fonctionne pas ?
Bonjour tot le monde, je vous envois ci joint mon formulaire , le bouton ajouter marche bien mais le bouton modifier ne fonctionne pas je récupère pas les valeur de code GDO situé dans la cellule D (feuille remplissage) ci joint le fichier pour mieu comprendre. Merci de m'apporter votre aide
Bonjour,
Logique puisque ton code ne le reprend pas
Fais ceci dans ton formulaire1 macro Private Sub UserForm_Initialize()
Juste après Dim modification, ajoute ces deux lignes
Dim codeGDO
CodeGDO = Sheets("Remplissage").Range("D3:D" & Sheets("Remplissage").Range("D" & Rows.Count).End(xlUp).Row)
Plus bas juste après END WITH ajoute ceci :
ComboBoxGDO.List() = CodeGDO
Si ok, clique sur le v vert àcoté du bouton EDITER pour cloturer le fil lors de ta réponse
Amicalement
Merci ça me permet de récupérer les valeurs dans la liste déroulante mais j'arrive pas a récupérer tous les cellules de chaque ligne.
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
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
quelqun peut m'aider SVP
re,
Le code que tu places dans ton post ne se trouve pas dans le fichier que tu as placé dans ta demande. Quid ?
Si c'est dans le formulaire1, en haut des codes, modifie le code ComboGDO comme ceci
Dim ok As Boolean
Private Sub ComboBoxGDO_Change()
Dim ligne As Integer
Dim derlign As Long
If ok = True Then Exit Sub
With Sheets("Remplissage")
derlign = .Range("A65536").End(xlUp).Row
ligne = .Range("A3:AC" & derlign).Find(ComboBoxGDO, lookat:=xlWhole).Row
ok = True
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 With
ok = False
End Sub
Si ok, clique sur le V vert à coté du bouton EDITER pour cloturer le fil lors de ta réponse.
A te relire
Edit Dan : Modifie aussi ce code pour le bouton Annuler
Private Sub CommandButtonAnnuler_Click()
Unload Formulaire1
End Sub
Re,
Heu... fil cloturé .... c'est bon ou pas ???
oui c'est cloturé, Merci bien