Rowsource

coaben

XLDnaute Nouveau
j'ai crée un userform avec une liste de choix et j'ai un problème avec un rowsource qui devrait être egal a un NOM ( liste definie)
 

Pièces jointes

  • test_devis.zip
    25.6 KB · Affichages: 35
  • test_devis.zip
    25.6 KB · Affichages: 35
  • test_devis.zip
    25.6 KB · Affichages: 39

coaben

XLDnaute Nouveau
Re : Rowsource

j'ai trouver l'erreur.
liste_produit=DECALER(Produits!$A$2;0;0;NBVAL(Produits!$A:$A)-1;2)
le rowsource veux bien prendre la valeur de Liste_produit.

j'ai une autre erreur dans le code
Me.TXT_Mt_Produits.Value = Me.TXT_Mt_Produits.Value + Ligne_Config(1) * Ligne_Config(2)

voir dans l'excel

cliquer sur configurateur pour demarer:D
 

Pièces jointes

  • test_devis.zip
    23.4 KB · Affichages: 49
  • test_devis.zip
    23.4 KB · Affichages: 53
  • test_devis.zip
    23.4 KB · Affichages: 66

wilfried_42

XLDnaute Barbatruc
Re : Rowsource

bonjour

je tiens à apporter une precision sur val() et cdbl()

la saisie se fait sur une textebox don en alpha et donc libre

si on saisie une , comme separateur de decimal il faut utiliser cdbl
si on saisie le . du clavier numerique il faut utiliser val

val("123,45") ====> 123
cdbl("123,45") ===> 123,45

val("123.45") ====> 123,45
cdbl("123.45") ===> Erreur 13

je precise aussi que si rien n'est saisi dans la textbox : Cdbl de rien renvoie erreur 13
 

coaben

XLDnaute Nouveau
Re : Rowsource

voici le code complet

Private Sub BTN_Plus_Click()
Dim Ligne_Config(2) As Variant

If LST_Produits.ListIndex = -1 Then Exit Sub
Ligne_Config(0) = Me.LST_Produits.List(, 0)
Ligne_Config(1) = Application.InputBox("quantité :", _
"Produit : " & Ligne_Config(0), Type:=1)
If Ligne_Config(1) = False Then
MsgBox "ajout du produit" & Ligne_Config(0) & "annulé.", _
vbCritical, "ajout produit"
Exit Sub
End If

Ligne_Config(2) = Me.LST_Produits.List(, 0)
Me.TXT_Mt_Produits.Value = Me.TXT_Mt_Produits.Value + Ligne_Config(1) * Ligne_Config(2)
If CHK_Maintenance.Value = True Then Me.TXT_MT_Maintenance.Value = _
Me.TXT_Mt_Produits.Value * Range("Maintenance").Value
Me.TXT_Mt_Total.Value = CDbl(Me.TXT_Mt_Produits.Value) + _
CDbl(Me.TXT_MT_Maintenance.Value)
Me.TXT_Mt_Remise.Value = Format(Me.TXT_Mt_Total.Value * _
(1 - Me.TXT_Remise.Value / 100), "0")

LST_Config.AddItem
For i = 0 To 2
Me.LST_Config.List(Me.LST_Config.ListCount - 1, i) = Ligne_Config(i)
Next i
End Sub
 

Discussions similaires

Réponses
2
Affichages
349
Réponses
8
Affichages
498

Statistiques des forums

Discussions
312 765
Messages
2 091 892
Membres
105 084
dernier inscrit
lca.pertus