Macro Code Assistance needed

South_Florida

New Member
Joined
Jun 1, 2016
Messages
9
So I'm recording a macro to display an XY scatter plot graph. I have had to add a second data series to get the x-axis I need but when opening other .txt files this line of code fails as it has the name of the original .txt file used to create the macro. The problem line(s) of code are shown below.

ActiveChart.SeriesCollection(2).XValues = "='Pure Ethanol 12May16'!$O$1:$O$5"
ActiveChart.SeriesCollection(2).Values = "='Pure Ethanol 12May16'!$P$1:$P$5"

Just removing the 'Pure Ethanol 12May16'! line did not help as then it does not display my second series on the graph that I need. Any help would be greatly appreciated!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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