VBA Error: Axes(xlValue).Select

Peni

New Member
Joined
Aug 18, 2005
Messages
26
Hi all.

I have a document with several views. In every view there is some data to be plotted. Two of those views are working correct. But plotting in the other two views result in an axes error:

hartCoord = "B5:" + ChartDate + "5,B7:" + ChartDate + "15"
ActiveSheet.ChartObjects("Chart 4").Activate
ActiveChart.Axes(xlValue).Select //error in this line
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=Sheets("Data").Range(ChartCoord), PlotBy:=xlRows

This line "ActiveChart.Axes(xlValue).Select", what does it exactly do? I'm trying to find out what a possible error could be. What are typical errors sources for that line of code?

thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
It's not necessary to select the value axis (or the ChartArea) to set the Source, so you can remove those 2 lines.

To see what the code would be for selecting the value axis on that chart, record a macro while doing it manually.
 

Peni

New Member
Joined
Aug 18, 2005
Messages
26
Well i deleted those two lines without rewriting anything else. The error is gone. But what are the effects of that change? Is the functionality changed now? I have no idea what those two lines do/did.
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Peni said:
Well i deleted those two lines without rewriting anything else. The error is gone. But what are the effects of that change? Is the functionality changed now? I have no idea what those two lines do/did.

As I sid before those lines aren't necessary. They simply select objects on the chart (like if you clicked them).
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,053
Messages
5,835,149
Members
430,342
Latest member
Sailingexcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top