MSChart Column Label

How to specify my own column label in the legend instead of the default c1, c2, c3...?
Who is Participating?
adityauConnect With a Mentor Commented:
Try the following code. This will change the legend label.
c1 is the chart control.

' Declare the variant array.
Dim X(1 To 3, 1 To 3) As Variant
' Set the data.
For i = 1 To 3
    For j = 1 To 3
        X(i, j) = i * j
' Set the row labels.
X(1, 2) = "Wheat"
X(1, 3) = "Corn"
' Set the column labels.
X(2, 1) = "January"
X(3, 1) = "February"
' Set the chart data.
c1.ChartData = X
Éric MoreauSenior .Net ConsultantCommented:
You can also use this once your data is in your chart:
with mschart1
   .Column = 1
   .ColumnLabel = "Your label 1"
   .Column = 2
   .ColumnLabel = "Your label 2"
end with
mkngauAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.