Probleme excel 2007 la méthode 'ScaleType' del'objet 'Axis' à échoué
Bonjour,
J'ai un soucis depuis quelques jours don't je ne trouve pas la solution.
J'ai un excel VBA qui me permet de générer des fichiers PDFS en faisant des graphiques à partir des données receuillis dans Excel.
Le mois dernier, l'utilisateur a change de pcs, il est sous excel 2007, je ne sais pas de quelle version il disposait avant, et depuis ce code ne passé plus avec comme erreur :
la méthode 'ScaleType' del'objet 'Axis' à échoué
Code:
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 70 71 72 73 74 75 76 77
| f.Activate
Set dicoDate = CreateObject("scripting.dictionary")
For i = 2 To nbligne
RefDate = Left(Range("Y" & i).Value, 10)
If Not dicoDate.exists(RefDate) Then
dicoDate.Add RefDate, RefDate
End If
Next i
nbdate = dicoDate.Count
ReDim tabjob(nbdate)
ReDim tabuser(nbdate)
tabdate = dicoDate.Items
For j = 0 To nbdate - 1
For i = 2 To nbligne
If Left(Range("Y" & i).Value, 10) = tabdate(j) Then
tabjob(j) = tabjob(j) + 1
End If
Next i
Next j
g.Activate
Range("W1") = "Date"
Range("X1") = "NbJob"
For i = 2 To nbdate + 1
Range("W" & i) = tabdate(i - 2)
Range("X" & i) = tabjob(i - 2)
Next i
Range("W1:X" & nbdate + 1).Select
ActiveWorkbook.Worksheets("TCD").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("TCD").Sort.SortFields.Add Key:=Range("W2:W" & nbdate + 1), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("TCD").Sort
.SetRange Range("W1:X" & nbdate + 1)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
For i = 2 To nbdate
If Range("W" & i + 1) <> Range("W" & i) + 1 Then
Range("W" & i + 1 & ":X" & i + 1).Insert
Range("W" & i + 1) = Range("W" & i) + 1
Range("X" & i + 1) = 0
nbdate = nbdate + 1
End If
Next i
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("'TCD'!$W$1:$X$" & nbdate + 1)
ActiveChart.ChartType = xlLine
ActiveChart.SetElement (msoElementChartTitleAboveChart)
ActiveChart.ChartTitle.Text = "Nombre de Job par jour"
ActiveChart.ChartTitle.Characters.Font.Size = 14
ActiveChart.Axes(xlCategory).MinimumScaleIsAuto = True
ActiveChart.Axes(xlCategory).CategoryType = xlAutomatic
ActiveChart.Axes(xlCategory).ReversePlotOrder = False
ActiveChart.Axes(xlCategory).Crosses = xlMaximum
ActiveChart.ChartStyle = 14
ActiveChart.HasLegend = False
With ActiveSheet.ChartObjects(7)
.Left = Range("AA2:AJ15").Left
.Top = Range("AA2:AJ15").Top
.Width = Range("AA2:AJ15").Width
.Height = Range("AA2:AJ15").Height
End With |
Merci d'avance pour votre aide, je ne m'y connais pas beaucoup en vba...