ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro not updating labels? XL 2007 (https://www.excelbanter.com/excel-programming/409410-macro-not-updating-labels-xl-2007-a.html)

Lance Hoffmeyer[_3_]

Macro not updating labels? XL 2007
 
Hey all,

I have a macro that I wrote in XL 2003 that updates labels in a chart for me.
When I moved to XL 2007 it quit working. It doesn't give an error. The labels
just don't change?

The chart is IDX, the datasheet with labels is IDX-1

Any help would be appreciated.

Lance



Sub SetDataPoints2()
Idx = ActiveSheet.Index
Sheets(Idx - 1).Select
Application.ScreenUpdating = False

LCount = Sheets(Idx).Cells(42, 12)
For i = 1 To LCount
ActiveChart.SeriesCollection(i).ApplyDataLabels AutoText:=True, LegendKey:=False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=False, ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(i).Select
ActiveChart.SeriesCollection(i).Points(1).Select
ActiveChart.SeriesCollection(i).Points(1).ApplyDat aLabels AutoText:=True, LegendKey:=False, ShowSeriesName:=True, ShowCategoryName:=False, ShowValue:=False, ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(i).Points(1).DataLabe l.Characters.Text = Sheets(Idx).Cells(i + 16, 1).Value
If Sheets(Idx).Cells(i + 16, 4).Value Sheets(Idx).Cells(i + 16, 5).Value Then ActiveChart.SeriesCollection(i).Points(1).DataLabe l.Position = xlLabelPositionAbove
If Sheets(Idx).Cells(i + 16, 4).Value < Sheets(Idx).Cells(i + 16, 5).Value Then ActiveChart.SeriesCollection(i).Points(1).DataLabe l.Position = xlLabelPositionBelow

ActiveChart.SeriesCollection(i).DataLabels.Select
ActiveChart.SeriesCollection(i).Points(2).ApplyDat aLabels AutoText:=True, LegendKey:=False, ShowSeriesName:=True, ShowCategoryName:=False, ShowValue:=False, ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(i).Points(2).DataLabe l.Select
Selection.Delete

ActiveChart.SeriesCollection(i).DataLabels.Select
ActiveChart.SeriesCollection(i).Points(3).ApplyDat aLabels AutoText:=True, LegendKey:=False, ShowSeriesName:=True, ShowCategoryName:=False, ShowValue:=False, ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(i).Points(3).DataLabe l.Select
Selection.Delete

Next i

End Sub


All times are GMT +1. The time now is 06:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com