VBA Linechart with multiple series and dynamic data

artz

Well-known Member
Joined
Aug 11, 2002
Messages
830
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I want to compare the percent growth of various stocks that I am following. The percent calulation starts in column B, row 5 extending to column Y. Stock names are in row 4 starting in column B. Dates are in column A.

The data ranges (number of rows) and number of used columns can vary. The percent calculation is based on the values on another worksheet called Data.

Below is an example of the new worsheet named Percent:

Excel Workbook
ABCDEFGHIJK
4DateCOHFASTTPXUAASNAATHNGCOLULUULTAVAL
512/14/2011-0.9%-0.2%-1.8%-0.7%-0.6%-3.1%-1.2%-2.7%-4.8%-1.1%
612/15/2011-2.1%1.0%-1.2%-0.5%-0.1%-18.1%-0.4%0.7%-5.5%-0.2%
712/16/2011-4.1%2.6%2.6%-0.5%3.1%-17.6%0.2%1.0%-5.1%1.0%
812/19/2011-5.2%2.8%-2.1%-3.3%4.1%-19.8%0.3%0.7%-8.1%0.9%
912/20/2011-2.4%7.1%0.6%-2.9%9.0%-17.3%5.2%4.4%-5.2%3.2%
1012/21/2011-0.3%6.8%0.7%-4.5%8.4%-17.7%7.6%2.4%-6.7%3.6%
1112/22/2011-0.5%6.2%5.8%-5.2%6.9%-18.0%6.9%4.4%-9.1%5.7%
1212/23/20111.9%8.2%4.9%-1.7%7.3%-17.6%7.2%6.9%-6.2%6.7%
1312/27/20112.8%8.7%3.2%-1.0%8.7%-17.8%8.9%8.5%-7.2%5.9%
1412/28/20111.3%8.4%0.8%-2.6%6.6%-17.5%6.9%5.1%-9.2%6.2%
1512/29/20112.5%9.8%4.8%-3.5%8.7%-16.3%8.1%5.0%-8.4%7.7%
1612/30/20111.6%8.0%2.3%-3.6%7.5%-18.0%6.9%4.1%-8.1%7.8%
171/3/20120.0%8.4%7.5%-3.1%8.5%-16.4%1.5%5.0%-9.2%8.5%
181/4/20122.5%9.9%9.1%-2.4%11.6%-15.7%5.0%14.1%-6.0%10.0%
191/5/20123.0%11.8%13.4%-1.7%17.9%-11.9%9.3%16.3%-1.5%10.4%
201/6/20124.3%12.0%14.0%-0.4%17.1%-11.2%7.3%19.8%-1.6%11.9%
211/9/20124.7%11.9%13.1%-0.1%20.8%-9.6%7.3%19.3%-1.0%10.7%
221/10/20123.8%11.5%13.0%0.9%21.7%-9.7%6.5%33.6%-0.2%13.1%
231/11/20121.6%12.0%16.0%1.7%21.6%-8.0%6.4%35.2%1.6%13.6%
241/12/20122.1%13.6%16.4%4.3%22.7%-6.6%6.2%36.7%1.9%14.9%
251/13/20123.3%15.4%14.8%3.6%23.4%-9.6%2.5%38.3%3.6%15.8%
261/17/20124.3%15.9%14.1%2.4%25.0%-9.6%3.5%35.4%5.0%15.8%
271/18/20127.5%12.8%18.0%-1.7%27.6%-3.6%3.4%35.0%7.3%17.0%
281/19/20128.2%13.3%22.3%-2.1%27.9%-3.6%3.5%34.2%9.6%17.9%
291/20/20128.0%13.6%19.2%-1.2%28.2%-4.8%3.3%34.2%8.0%16.5%
301/23/20127.0%14.1%17.8%1.7%27.8%-6.4%2.7%39.3%8.9%15.9%
Percent


I need just a simple linechart with all the series that are available in columns B through Y. I would like no markers, thin lines, a legend on the right, and the Y axis is on the right at the maximum date. Also a title, "Percent Returns" would be nice.

Could anyone on the board help with VBA code to create a chart as described above? Any help is appreciated.

Thanks,

Art
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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