View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kristin Kristin is offline
external usenet poster
 
Posts: 43
Default Data Labels Macro

This has also been posted on the Mr. Excel boards but has not generated any
response. I am working on modifing a chart using VB. I recorded the macro
at first and got the following lines of code:

ActiveChart.SeriesCollection(2).Points(1).DataLabe l.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.ColorIndex = 2
.Background = xlTransparent
End With
With Selection
.Position = xlLabelPositionInsideBase
End With

When I try to rerun this code without any modification, I get the following
error:

Select method of DataLabels class failed.

I looked on a few boards and modified the code to look like this:

ActiveChart.SeriesCollection (1)
.HasDataLabels = True
.ApplyDataLabels Type:=xlValue
Selection.AutoScaleFont = True
With .DataLabels.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.ColorIndex = 2
End With
With .DataLabels
.Position = xlLabelInsideBase
End With

When i run this code, I get this error:

Invalid or unqualified reference

Is there some reference library that I need to select or something I need to
change in the code? Any ideas would be greatly appreciated.

Kristin