MSChart Column Label

How to specify my own column label in the legend instead of the default c1, c2, c3...?
mkngauAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

adityauCommented:
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
    Next
Next
' 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
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
É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
0
mkngauAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.