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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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.
 
Upvote 0
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.
 
Upvote 0
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).
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,643
Members
449,093
Latest member
Ahmad123098

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
Back
Top