MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Graph - Macro

Posted by Andrew Haigh on December 07, 2001 7:49 AM

Could u please tell me how to create a macro to insert a graph, what i want to do is, so when i press a button, a graph sould be inserted automatically on to the same work sheet, not a spearate work sheet.


Posted by scott on December 07, 2001 10:37 AM

A easy way is to start recording a macro, and then build the graph...when done, stop recording and you will have a macro that creates a graph. Then you can attach it to a button on the "Forms" tool bar. Then, just click the button and a graph will appear. Its not the most pretty way to do it, but it can get the job done. However, there is also the "pretty" alternative, which involves userforms, and requires coding. It is not difficult is the link (you will have to look for tip #13 called "" Download the file to see how it works, and then you can copy the code to your file, and customize it as you would like to use it. Post again if you have any questions about this...I am not sure how familiar you are with excel/macros and I am willing to help you out, so don't sweat it-just ask for help. Good luck, here's that link: