1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
AU DESSUS IL Y A UN FILTRE COMME C'EST DEJA LE BORDEL JE VOUS AI EPARGNE CELA :mrgreen:
nom = ComboBox1.Value
Range("7:7").Find(nom, , xlValues, xlWhole, , , False).Select
ActiveCell.Select
Colonne = ActiveCell.Column
ligne = ActiveCell.Row
Dim coef As Range
Set coef = Range("d10:d1956")
For Each w In coef
If w.EntireRow.Hidden = False Then datafound = True: Exit For
Next
Set graphdata = Sheets("saisie").Range(Cells(ligne + 3, Colonne), Cells(ligne + 1949, Colonne))
For Each w In graphdata
If w.EntireRow.Hidden = False Then datafound = True: Exit For
Next
If datafound = False Then Sheets(ComboBox1.Value).Select: MsgBox "Deux possibilités : Soit il n'y a pas de données pour cette sélection soit vous avez oublié d'enlever les filtres précédents": Exit Sub
Dim wsData As Worksheet, wsChart As Worksheet
Dim rngChart As Range
Dim objChart As ChartObject
Dim objLE As LegendEntry
ActiveSheet.Protect Password:="toto", DrawingObjects:=False, Contents:=True, Scenarios:=True
Feuil6.Select
ActiveSheet.Unprotect Password:="toto"
Set wsData = Feuil2
Set wsChart = ActiveSheet
On Error Resume Next
wsChart.ChartObjects(1).Delete
On Error GoTo 0
Set objChart = wsChart.ChartObjects.Add _
(Left:=wsChart.Columns("c").Left, _
Top:=wsChart.Rows(9).Top, _
Width:=800, _
Height:=280)
With objChart.Chart
.ChartType = xlColumnClustered
.SetSourceData Source:=Union(graphdata, coef)
.HasTitle = True
.ChartTitle.Text = "Notes de " & ComboBox1.Value & " entre le " & TextBox1.Value & " et le " & TextBox2.Value & " avec le niveau correspondant"
.HasLegend = False
.Axes(xlValue).MinimumScale = 0
.Axes(xlValue).MaximumScale = 20
End With
Unload Me
Set objChart = Nothing
Set rngChart = Nothing
Set wsChart = Nothing: Set wsData = Nothing
ActiveSheet.Protect Password:="toto", DrawingObjects:=False, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub |
Partager