VBA adding series to a graph w/ variables

hissonrr

Board Regular
Joined
Feb 6, 2016
Messages
106
Good day All,

I am newish to VBA especially in regards to adding code that manipulates a graph. I was wondering if anyone could help me out. I have an existing XY scatter plot graph for the sake of this query lets call it graph 1.

what I would like this VBA code to do is when I run it create a new series in my graph using a range of cells that I can define.

So basically it would be something like

1. create a new series using a range of cells in column A:B
2. depending on a variable in the code I would like to manipulate that range of cells
2A. so for example if my last series X axis ended at cell A5. It would create a series from cell A5 through cell A"XXXX" that I can define. preferably in increments of 10 so I can create multiple buttons.
2B. I would like to be able to reference a cell to define that variable (so like if cell D10 =50, then take cells A5:A50 for the x series of data
2C. the same with the y axis I need to be able reference an external cell in the workbook for this variable​
3. I need it to recognize when the previous series on the graph stops along the Y axis and X axis so I can make this series that is being created as a continuation of the previous series.

I am not 100% sure this is any good at explaining what I need but if anyone has anything that could help I would be thankful so I can start building what I need.

Regards,

-R
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,215,518
Messages
6,125,293
Members
449,218
Latest member
Excel Master

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