bonjours a tous,
j'ai besoin de votre aide pour modifier se code
il génère un graphique suivant une plage de date
et moi je voudrai avoir a choisir juste une année
ou
j'ai besoin de votre aide pour modifier se code
il génère un graphique suivant une plage de date
et moi je voudrai avoir a choisir juste une année
Code:
Sub lescombo()
Set dico = CreateObject("Scripting.Dictionary")
For Each c In Feuil3.Range(Feuil3.[A2], Feuil3.[A65000].End(xlUp))
If Not dico.Exists(c.Value) And c.Value <> "" Then dico.Add c.Value, c.Value
Next c
Feuil1.ComboBox1.List = dico.items
Feuil1.ComboBox2.List = dico.items
End Sub
Sub mygraf()
Dim Plage As Range
If Feuil1.ComboBox1 = "" Or Feuil1.ComboBox2 = "" Then Exit Sub
With Feuil3
For k = 2 To .[A65000].End(3).Row
If CDate(.Cells(k, 1)) >= CDate(Feuil1.ComboBox1) And CDate(.Cells(k, 1)) <= CDate(Feuil1.ComboBox2) Then
If Plage Is Nothing Then
Set Plage = Union(.Cells(k, 2), .Cells(k, 5))
Else
Set Plage = Union(Plage, .Cells(k, 2), .Cells(k, 5))
End If
End If
Next
End With
If Plage Is Nothing Then MsgBox "Pas de données": Exit Sub
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Plage
ActiveChart.ChartType = xlColumnClustered
ActiveChart.Location Where:=xlLocationAsObject, Name:="graph."
End Sub
ou