bonjour d3d9x
on s'est croisé quand je mettai le classeur fonctionnel, mais ton code me retourne l'erreur 70 a Me.cboTVA.AddItem tva(nbTVA)
on en revient au même point
voici le code complet attention très long mais amputé
Option Explicit
Dim Total As Currency, T1 As Currency, T2 As Currency ', MHT As Currency
Dim Li As Long, Lx As Long
Dim i As Long, Tblo(1 To 12)
'====================================test co-viles intégré
Private Sub cboCP_Click()
Dim Choix$, Cell As Variant
Choix = Me.cboCP.Value
For Each Cell In Selection
If Cell.Text = Choix Then Me.lstVille.AddItem Cell.Offset(0, 1).Value
Next Cell
[A1].Select
End Sub
'============================================
Sub Init1()
Dim NoDept As New Collection
Dim A()
Dim i%, J%, NoValeur%
Dim Swap1$, Swap2$
End Sub
'=======================fin test cp-villes====================================
Private Sub ajout_Click()
Dim MontantHt As Double, MontantTva As Double, MontantTc As Double, MontantRemise As Double, L As Long
'=======================code tva=================================
If Me.cboTVA.Value = "0,10" Then
.ListItems(L).ListSubItems.Add , , "1"
Else
.ListItems(L).ListSubItems.Add , , ""
End If
If Me.cboTVA.Value = "0,20" Then
.ListItems(L).ListSubItems.Add , , "2"
Else
.ListItems(L).ListSubItems.Add , , ""
End If
'==================================================================
If Me.cboTVA.Value = "0,10" Then
.ListItems(L).ListSubItems.Add , , Format(MontantTva, "0.00")
Else
.ListItems(L).ListSubItems.Add , , ""
End If
If Me.cboTVA.Value = "0,20" Then
.ListItems(L).ListSubItems.Add , , Format(MontantTva, "0.00")
Else
.ListItems(L).ListSubItems.Add , , ""
End If
Private Sub lstArticle_Click()
txtArticle = "": Txtunite = "": Txt_qté_vente = "": TextBox2 = "": TextBox4 = "": txtPU = ""
Usf_articles.Show
End Sub
Private Sub nomfeuil_Change()
nomfeuil.ShowDropButtonWhen = 0
End Sub
Private Sub quit_Click()
Unload Me
End Sub
Private Sub UserForm_Activate()
Dim tva As Variant
Dim nbTVA As Integer
tva = Array("0,10", "0,20")
For nbTVA = 0 To 1
Me.cboTVA.AddItem tva(nbTVA)
Next nbTVA
End Sub
Private Sub UserForm_Initialize()
'Effacer
With ListView1
With .ColumnHeaders 'Mise en page des en-têtes
.Clear
.Add , , "n°", 40
.Add , , "tranche", 50
'.Add , , "texte", 20
.Add , , "Nomination de l'article", 200
.Add , , "Unité", 40
.Add , , "Qté_vente", 40
.Add , , "PuHt", 60
.Add , , "obtva10", 60
.Add , , "obtva20", 60
.Add , , "tva10", 60
.Add , , "tva20,6", 60
.Add , , "Remise", 60
.Add , , "TotalHt", 60
.Add , , "TotalTtc", 60
End With
.View = 3 ' type Report
.Gridlines = True ' affichage de lignes
.FullRowSelect = True ' sélection complète de la ligne
.HideColumnHeaders = False ' afficher les en-têtes de colonnes
.LabelEdit = 1 ' ne pas autoriser la saisie
.BackColor = RGB(255, 255, 255)
.ForeColor = RGB(0, 0, 0)
.Font.Size = 11
.FlatScrollBar = False
End With
Me.obTranche = True
Me.obCommentaire = False
TextBox2.SetFocus
'Me.modif.Visible = False
TxAdCh.Visible = False
'ouverture.Show
CB_OK.Visible = False
Lbcp.Visible = False
Txadresse.Visible = False
LBville.Visible = False
cboCP.Visible = False
LBadresse.Visible = False
lstVille.Visible = False
txtclient.Text = Range("J4").Value
Lbdate.Caption = Sheets("Facture").Range("R1")
Lb_nomfeuil.Caption = Sheets("Facture").Range("D1")
Lbnfeuil.Caption = Lb_nomfeuil.Caption & " " & "N°"
End Sub
comme cela on peu voir ou est utiliser le cboTVA
edit Minanse pas vu ta réponse et comment y utiliser cette boucle for