Faire un graphique en excluant les cellules vides
j
Bonjour, je cherche à faire un graphique sur deux plages de données (en colonnes) qui sont définies sur le code par coef et graphdata. J'aimerais que le graphique n'affiche les valeurs que lorsque les cellules de coef et de graphdata (sur une même ligne) ne sont pas vides.
Que faudrait_il que j'ajoute à ce code svp ?
Merci à vous
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
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