Ger
04-02-2012, 05:32 AM
Hi,
I used a macro to put text in a graph. It worked fine with excel97. In excel 2010 the macro doesn't work anymore. I need some help to rewrite it.
The text in column "C" is the text which must be displayed in the graph.
Sub Macro3()
'
' Macro3 Macro
' De macro zorgt ervoor dat de labels uit kolom c in de grafiek worden gezet
'
'
Sheets("grafiek").Select
Dim Lastrow As Long
Dim i As Long
With ActiveSheet
Lastrow = .Cells(.Rows.Count, "C").End(xlUp).Row
With .ChartObjects("grafiek 1").Chart
For i = 2 To Lastrow
ActiveSheet.ChartObjects("Grafiek 1").Activate
ActiveChart.SeriesCollection(1).Points(i - 1).DataLabel.Select
Selection.Text = "=grafiek!R" & i & "C3"
Next i
End With
End With
ActiveWindow.Visible = False
End Sub
Ger
I used a macro to put text in a graph. It worked fine with excel97. In excel 2010 the macro doesn't work anymore. I need some help to rewrite it.
The text in column "C" is the text which must be displayed in the graph.
Sub Macro3()
'
' Macro3 Macro
' De macro zorgt ervoor dat de labels uit kolom c in de grafiek worden gezet
'
'
Sheets("grafiek").Select
Dim Lastrow As Long
Dim i As Long
With ActiveSheet
Lastrow = .Cells(.Rows.Count, "C").End(xlUp).Row
With .ChartObjects("grafiek 1").Chart
For i = 2 To Lastrow
ActiveSheet.ChartObjects("Grafiek 1").Activate
ActiveChart.SeriesCollection(1).Points(i - 1).DataLabel.Select
Selection.Text = "=grafiek!R" & i & "C3"
Next i
End With
End With
ActiveWindow.Visible = False
End Sub
Ger