Excel Chart from VB

I have figured out how to create an Excel Chart from VB my problem is I want to change the Category (x) axis labels and I cannot find a property that corresponds to it here is how to do it manually

Right click on the chart
Go to Source Data
Then the Series Tab
Then  Category (x) axis labels
and just enter the values you want but what I need to know is how to do this from code

I just need to know how to do it from code
Thank you
cdthurmanAsked:
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.

EDDYKTCommented:
I use record from macro and get this
Tools->Macro->Record the macro

When you've finished, press Alt-F11 to see code



ActiveChart.SeriesCollection(1).XValues = "={""abcdd""}"
0
mvidasCommented:
cdthurman,

To take EDDYKT's answer one step further, if you want to take the values from a portion of your worksheet or reference the chart without using the activechart, you can use syntax like:

 Charts("Chart1").SeriesCollection(1).XValues = Sheets("Sheet1").Range("C2:C13")

Also, instead of using the "={""abcdd""}" you could use

 ActiveChart.SeriesCollection(1).XValues = Array("abc", "def", "ghi")

Matt
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
cdthurmanAuthor Commented:
You guys rock
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.

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.