Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

VBA To Automatic update Chart

0

Hi all,

I have excel sheet which is mannually record equiments everyday ,

I would like to create a chart ( see attached file) 

Right now , i have to manually do , does anyone can help with the code ?

Thanks,

Mark 

Answer
Discuss

Answers

0

This is actually a great candidate for trying the macro recorder - so long as you just select the data and add the chart, you won't get lots of annoying extra code.

That said, here is a little snippet of code that you can use to generate the first chart:

ActiveSheet.Shapes.AddChart2(201, xlColumnClustered).Select
ActiveChart.SetSourceData Source:=Range("'Chart '!$A$2:$F$10")

$A$2:$F$10 is the range of the data for the chart.

xlColumnClustered is the type of chart to add.

Here is more info about using AddChart2: https://msdn.microsoft.com/en-us/vba/excel-vba/articles/shapes-addchart2-method-excel

Here is a list of the chart types that you can use: https://msdn.microsoft.com/en-us/vba/excel-vba/articles/xlcharttype-enumeration-excel

Discuss

Discussion

Any code that help transfer for database to the chart table instead of manually ?

Thanks for look into it 
MM
bmark0225 (rep: 2) Jul 25, '18 at 11:49 am
That sounds like a separate issue!? If it is then please just ask another question for it along with a more detailed description of what you actually need done. But, how does the above answer work for your question though?
don (rep: 1989) Jul 25, '18 at 2:02 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login