Need VBA code to create dynamic line charts

sabha

New Member
Joined
Oct 10, 2015
Messages
21
Hi so this is my chart and x stands for a number (BTW my table has more than this many columns and rows):

Countries 1 2 3 4 5
AMS
Canada x x x x x
U.S. x x x x x
Mexico x x x x x

Europe
Italy x x x x x
France x x x x x
Germany x x x x x
Russia x x x x x

APP Korea x x x x x
China x x x x x
Japan x x x x x
Hong Kong x x x x x
India x x x x x

I want to create a dynamic line chart using VBA for every region. For example, when I highlight the range from Canada to Mexico, I want a line chart that will include all the country names in the legend and the numbers 1,2,3,4,5 will be by horizontal axis. Now when I highlight the range from Italy to Russia, I want to do the same thing but for those countries. Same goes for the countries under APP. The only thing common among all charts should be the horizontal axis of 1,2,3,4,5. Please help! Thanks :)
 
Dom -

Good adjustment of my code.

I don't understand why the OP is getting the messages he reports.
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
ughh I am so frustrated!! I don't know why this is happening! I can't even attach a picture of my workbook on here...
 
Upvote 0
JKKK IT WORKS!!! I never noticed there was another code above this code since I never scrolled up...THANK Y'ALL SO MUCH!! :)
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,114
Members
452,302
Latest member
TaMere

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