Serving the Quantitative Finance Community

 
User avatar
cryptic26
Topic Author
Posts: 0
Joined: February 18th, 2002, 9:39 am

Macro for XY labeling in Excel Chart

November 5th, 2003, 6:05 pm

I need small help related to labeling datapoints in XY charts in excel. I want to make a VB macro for labeling each data points that are split into 8 different series. Each data point has a x, y as in excel but they are numeric values. I need to add a specific name to each datapoint from a column of 58 names in excel spread sheet. Can anyone give a basic infrastructure of the code to be used in vb for the same. It will automate the labeling business, rather than using external add-ins or doing by hand. Someone proposed this code, which I modified. Having some syntax problem in the macro, in the line "Cht.SeriesCollection(j).Points(i).DataLabel.Charachters.Text = TextRange(k) " I have also uploaded the excel sheet to run the macro named "AddLabels" The factors are in the sheet currentmonthsummary and are categorized . The graph is currentmonthgraph and has the datapoints that need to be labeled accordingly. Someone, have a look and please correct. Am new to VB. Sub Addlabels()Dim TextRange As RangeSet TextRange = Sheets("currentmonthsummary").Range("A2:A60") 'assign the rangeNoOfDataSeries = 8NoOfPoints = 7For j = 1 To NoOfDataSeriesFor i = 1 To NoOfPointsSheets("currentmonthgraph").Selectk = (j - 1) * NoOfPoints + i + OffsetActiveChart.SeriesCollection(j).Points(i).DataLabels.Characters.Text = TextRange(k)Next iNext jEnd Sub
 
User avatar
martinigale
Posts: 0
Joined: October 22nd, 2003, 12:50 pm

Macro for XY labeling in Excel Chart

November 13th, 2003, 10:46 am

anybody worked this out yet ?
 
User avatar
cryptic26
Topic Author
Posts: 0
Joined: February 18th, 2002, 9:39 am

Macro for XY labeling in Excel Chart

November 15th, 2003, 9:23 am

yes, i did. If someone wants then I can email my code.
 
User avatar
martinigale
Posts: 0
Joined: October 22nd, 2003, 12:50 pm

Macro for XY labeling in Excel Chart

November 17th, 2003, 3:23 am

check your private messagebox, cryptic
 
User avatar
cryptic26
Topic Author
Posts: 0
Joined: February 18th, 2002, 9:39 am

Macro for XY labeling in Excel Chart

November 18th, 2003, 4:02 am

I sent the code. Check private message.