You are currently viewing How to activate a chart using Excel VBA

How to activate a chart using Excel VBA

Excel VBA is a feature on excel that allows the user to use the programming language of excel to open or create a certain thing on excel. Chart drawing is one of the features of excel software. On Excel, charts can be drawn using two methods: the chart tools method and activating Excel VBA. The VBA method involves a more complicated procedure as compared to the other method. Thus, it may pose a challenge to a new excel user who is willing to use this method to construct a chart. This article will help you familiarize yourself with Excel's VBA, and you can comfortably use the feature without experiencing any problem.

Below are the simplified and well-explained steps that are involved in activating and using the VBA feature.

 

1. Open the excel application.

On your device, locate and launch the excel application. Originally, the page is divided into two sections: the top bars and the blank body part. The top bars enable the user to manipulate the chart and another document, while the body part is where the data and the information about the table are located.

2. Input the chart's data

Once you've successfully opened the app, go ahead and input each data inputted data and title on the blank cells provided.

3. Open Excel's VBA

After your data is set, click on the Developer tab, located on the other tabs' left side. On the Developer section, locate and click on the basic visual button. This button enables the users to access the VBA, where they can input their programming codes. Alternatively, you may choose to use excel's shortcut of accessing VBA (Alt+F11).

4. Create a new module

To use the VBA, one has to create a module on which the codes will be inputted. To achieve this, click on the Insert tab, located on the top bars on the screen. Then, click on the module button within the insert section.

5. Input the codes that will activate the chart

After clicking the module button, a new blank page opens. The blank page allows the user to write the code that will modify the given data to a table. Some of the things that should be included in your code are the location of your data on the document (to link the codes with the excel sheet), the chart type, the title of the chart, and the axes' name. A sample of a program that can be used to activate and create a chart is shown below.

6. Save and run

Once you are done with writing your code, click the file button on the top bar. Then, click on the first button to save the sheet on your device. Alternatively, click Ctrl+ S. Finally, run the module, and the data on the sheet will be converted automatically to charts according to the set information on the VBA module.

Therefore, using the above steps, you can easily develop your chart using this VBA excel feature.