Formulaire de recherche

Dzk78

XLDnaute Nouveau
Bonjour,

Je souhaite réaliser un formulaire de recherche pour voir le solde d'un compte à partir du nom de famille compilé dans une ComboBox.
Voilà la macro (elle est affecter au bouton "CONNAITRE LE SOLDE DE LA CARTE PDV D'UN ELEVE":
VB:
Private Sub CommandButton1_Click()
If Not ComboBox1.Value = "" Then
Dim no_ligne As Integer

    no_ligne = ComboBox1.ListIndex + 1
    TextBox1.Value = Cells(no_ligne, 1).Value
    TextBox3.Value = Cells(no_ligne, 3).Value
    TextBox4.Value = Cells(no_ligne, 2).Value
   
Else
End If
End Sub

Mais ma macro ne fonctionne pas. Pourriez m'aider s'il vous plait?

En vous remerciant par avance !

Dzk78
 

Pièces jointes

  • PDVEZELAK.xls
    23 KB · Affichages: 34

Papou-net

XLDnaute Barbatruc
Bonjour Dzk78, M12, le Forum,

Petite erreur d'inattention? Il suffit simplement de référencer la feuille SOLDE dans la macro:

Private Sub CommandButton1_Click()
If Not ComboBox1.Value = "" Then
Dim no_ligne As Integer
no_ligne = ComboBox1.ListIndex + 1
TextBox1.Value = Sheets("SOLDE").Cells(no_ligne, 1).Value
TextBox3.Value = Sheets("SOLDE").Cells(no_ligne, 3).Value
TextBox4.Value = Sheets("SOLDE").Cells(no_ligne, 2).Value
Else
End If
End Sub

Cordialement.
 

Papou-net

XLDnaute Barbatruc
RE

Une autre erreur dans le code: la définition de la valeur de no_ligne.

Private Sub CommandButton1_Click()
If Not ComboBox1.Value = "" Then
Dim no_ligne As Integer
no_ligne = ComboBox1.ListIndex + 2
TextBox1.Value = Sheets("SOLDE").Cells(no_ligne, 1).Value
TextBox3.Value = Sheets("SOLDE").Cells(no_ligne, 3).Value
TextBox4.Value = Sheets("SOLDE").Cells(no_ligne, 2).Value
Else
End If
End Sub

Cordialement.
 

M12

XLDnaute Accro
Re Dzk78 et Bonjour Papou-net

J'ai téléchargé 3 fois la 1 ère PJ est chez moi, NIET - Rien dans les onglets et dans le développeur

Ou je suis "Con" ou il y a un mystère :confused:
 

Pièces jointes

  • PDVEZELAK (1).xls
    23 KB · Affichages: 29
  • PDVEZELAK (2).xls
    23 KB · Affichages: 24
  • PDVEZELAK (3).xls
    23 KB · Affichages: 31

Discussions similaires

Réponses
6
Affichages
235

Statistiques des forums

Discussions
312 176
Messages
2 085 963
Membres
103 068
dernier inscrit
Strogoff