• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to draw a chart by VBA

IceFrogBG

Member
Now I want to make a small project which can draw a chart auto.
Anyone here already done can help me.
Or give me a idea.
Thanks so much.
 

Attachments

  • Request1.xlsx
    21.7 KB · Views: 4
To get you started, create your chart manually while Recording a Macro.

First, click on the Developer tab, then find the Code section (left side of menu ribbon) and Click on Record Macro. See below.
upload_2017-10-6_12-7-35.png
Create the chart manually.
Once you have completed creating your chart, return to the Developer tab and click on Stop Recording which is in the same place as the Record Macro button was.

Press ALT + F8 and click on the edit button in the right side of the window.

upload_2017-10-6_12-11-23.png

Highlight the information you see and report back here by pasting it in the window using the
upload_2017-10-6_12-16-11.png
I apologize if you already knew this; however, this will get you help the quickest.
 
I know you asked for a VBA solution and they are provided above

Did you consider using a single chart and linking it with a Control so you can browse through the data

upload_2017-10-7_9-53-4.png

In the example you use the spinner to increase or decrease the data being viewed. The Title and Series change as you click

See it implemented on your data in the attached file
 

Attachments

  • Request.xlsx
    21.7 KB · Views: 4
I know you asked for a VBA solution and they are provided above

Did you consider using a single chart and linking it with a Control so you can browse through the data

View attachment 46187

In the example you use the spinner to increase or decrease the data being viewed. The Title and Series change as you click

See it implemented on your data in the attached file
Hello Hui,
Thank you so much.
You give me a many answer (for my question).
This case I want to create a char which display the percentage of NG % only.
Each checker have one chart at right (and the number of checker item is not fix).
 
Hello Hui,
Thank you so much.
You give me a many answer (for my question).
This case I want to create a char which display the percentage of NG % only.
Each checker have one chart at right (and the number of checker item is not fix).

Can you please explain your requirements as your comments are unclear
 
Can you please explain your requirements as your comments are unclear
Hello Hui,
Sorry because my explain is not clear.
Can you see attached file,I wrote some comment here.
Thanks so much.
 

Attachments

  • Request1.xlsx
    26.1 KB · Views: 2
How many charts do you have to do?

Because if it is only 6

Copy the chart and paste it below itself
then select the chart and select the series
Then when it highlights the data range, drag the range to the next location
 
Select the Chart
upload_2017-10-8_17-3-51.png
Note that the Data Series is selected as it is the only one there
Press Ctrl+C

Select the Cell Below the Chart
upload_2017-10-8_17-4-53.png
Press Ctrl+V
upload_2017-10-8_17-6-23.png
Click on the new Chart
Then click the series so it is selected like in the above picture
Now Drag the Blue Outline surrounding the Range C18:AG18 down to the Data at Row 22

Repeat for other charts
 
Back
Top