have a go with this
you can set the bounds for X & Y as well as the # of rows required in the code; you could easily adjust the code to retrieve these values from cells on the worksheet if they were something that needed to change regularly.
for the second requirement I adjust the upper and lower bounds for X based on the output of Y. my adjustment is relatively crude and am sure there are better ways to keep these numbers aligned, but it should be pretty easy to adjust as you see fit.
I have uploaded a copy of the file which contains the code.
the other change I made to the file was to create a dynamic Named Range (see this) for the data called DataSet, this will adjust to the number of rows of data you have, you can then point your chart at that Named Range so that it adjusts to whatever number of rows you generate.
note: I set the # of rows to 1000 in the attached file to keep the file size down so the site would accept the upload, a chart with 100,000 points made the file size too large to upload!
Bookmarks