help svp
bonsoir le forum !
j'ai presque réussit à faire ce que je voulais ! mais j'aimerai savoir si quelqu'un aurait la gentillesse de vérifier le bon fonctionnement et l'utilité des codes vba utilisés ; car je doute de certains :
dans un premier temps ce qui suit je ne sais pas si utile vu mon fichier (partie en vert):
Private Sub CommandButton1_Click()
Dim trouve As Boolean
Dim dl1 As Long ' dernière ligne
Dim Sh As Worksheet
If ComboBox1.ListIndex = -1 Then Exit Sub
If ComboBox8.ListIndex = -1 Then Exit Sub
If ComboBox9.ListIndex = -1 Then Exit Sub
Call calcul2
trouve = False
For Each Sh In Worksheets
If Sh.Name = ComboBox1.Value Then
trouve = True
End If
Next Sh
If trouve = False Then
With Sheets("Nom du client") ' jai plus de feuill nom du client estce utile ??
.Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = ComboBox1.Value
Range("B1") = ComboBox1.Value
Range("b2") = Sheets("Fichier client").Range("b" & ComboBox1.ListIndex + 2).Value
End With
End If
With Sheets(ComboBox1.Value)
For i = 1 To ListView1.ListItems.Count
dl1 = .Range("b65536").End(xlUp).Row + 1
'''''''' .Range("b" & dl1).Value = DTPicker2.Value
.Range("c" & dl1).Value = ListView1.ListItems(i).Text
.Range("d" & dl1).Value = ListView1.ListItems(i).ListSubItems(1).Text
.Range("e" & dl1).Value = ListView1.ListItems(i).ListSubItems(2).Text
.Range("f" & dl1).Value = ComboBox6.Value
.Range("i" & dl1).Value = ComboBox9.Value
Next i
dl1 = .Range("b65536").End(xlUp).Row + 1
''''.Range("b" & dl1).Value = DTPicker2.Value
.Cells(dl1, 5).Value = TextBox5.Value
.Cells(dl1, 6).Value = ComboBox6.Value
.Cells(dl1, 7).Value = TextBox7.Value
.Cells(dl1, 8).Value = ComboBox8.List(ComboBox8.ListIndex, 1)
.Cells(dl1, 9).Value = ComboBox9.Value
End With
enregistrement = True
End Sub
et celui la aussi: car la je crois avoir un doublon et je ne sais pas lequel garder ???????
' Utilisation :sélection d'une prestation
'-------------------------------------------------------------
Private Sub ListBox1_Click()
Dim feu1 As String
If ListBox1.TopIndex = -1 Then Exit Sub
ListBox2.Clear
'''''''''''ListBox2.RowSource = (ListBox1.List(ListBox1.ListIndex, (ListBox1.ColumnCount - 1)))
Dim x As Integer
Dim lig As Long
With Sheets("Prestations") ' je pense un doublon avec un peu plus bas
For lig = 1 To .Cells.SpecialCells(xlCellTypeLastCell).Row
If .Cells(lig, 1).Value = ListBox1.Value Then Exit For
Next lig
Do While .Cells(lig, 2).Value <> ""
ListBox2.AddItem .Cells(lig, 2).Value, x
ListBox2.List(x, 2) = .Cells(lig, 3).Value
x = x + 1
lig = lig + 1
Loop
End With
End Sub
Private Sub ListBox2_Click()
End Sub
Private Sub ListView2_BeforeLabelEdit(Cancel As Integer)
End Sub
Private Sub UserForm_Initialize()
With ListBox1 ' ComboBox1
.Clear
.ColumnCount = 2
.ColumnWidths = "50;0"
.AddItem "Autres"
.List(.ListCount - 1, .ColumnCount - 1) = "autres"
.AddItem "Soins visage"
.List(.ListCount - 1, .ColumnCount - 1) = "Soins_visage"
.AddItem "Massages"
.List(.ListCount - 1, .ColumnCount - 1) = "Massages"
.AddItem "Soins du corps"
.List(.ListCount - 1, .ColumnCount - 1) = "Soins_corps"
.AddItem "Maquillage"
.List(.ListCount - 1, .ColumnCount - 1) = "Maquillage"
.AddItem "Epilations"
.List(.ListCount - 1, .ColumnCount - 1) = "Epilations"
.AddItem "Forfait épilation"
.List(.ListCount - 1, .ColumnCount - 1) = "Forfait_epilation"
End With
' ce qui suit je ne sais pas à quoi sa sert mais si je le met sa me double les presta dans la listbox1 je crois que c'est le doublon
'Dim lig As Long
'With Sheets("Prestations")
'For lig = 2 To .Cells.SpecialCells(xlCellTypeLastCell).Row
'If .Cells(lig, 1).Value <> "" Then
' ListBox1.AddItem .Cells(lig, 1).Value
' End If
'lig = lig + 1
'Next lig
'End With
''''''''''''''''DTPicker2.Value = Format(Now, "dd/mm/yyyy")
' on indique le nom de la colonne suivie de la largeur
'Call entete(numéro de la listview , Array(titre de la première colonne , dimention de la colonne , titre de la deuxième colonne, dimention de la colonne, ....))
'"Date de visite "Prestation" 1 Prestation 2 Prestation 3 Produit acheté 1 Produit acheté 2 Produit acheté 3 Remises Montant facturé Mode de paiement Esthéticienne
Call entete(1, Array("DESIGNATION", 80, "Quant", 80, "PVTTC", 50))
Call entete(2, Array("DESIGNATION", 80, "ML", 50, "PVTTC", 50, "Stock", 50))
Call Affiche(2, "Produits", "b", Array("c", "e", "f"))
Call IniCombobox1(£nomfeuil:="Fichier client", £col:="a", £lig:=2, £num:=1, tri1:=True)
Call IniCombobox1(£nomfeuil:="Calcul", £col:="e", £lig:=4, £num:=9, tri1:=True)
Call IniCombobox1(£nomfeuil:="Calcul", £col:="b", £lig:=4, £num:=8, tri1:=True)
ComboBox6.AddItem Format(0.05, "0.00%")
ComboBox6.AddItem Format(0.1, "0.00%")
ComboBox6.AddItem Format(0.15, "0.00%")
ComboBox6.AddItem Format(0.2, "0.00%")
ComboBox6.AddItem Format(0.25, "0.00%")
ComboBox6.AddItem Format(0.3, "0.00%")
TextBox5.Value = 0
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then Cancel = True
End Sub
j'espère que ma demande est claire ?
fichier complet joint : (c) CJoint.com, 2008
de plus comment remplir ma feuille histo avec le bouton valider ????
merci d'avance