DEV Community

Andrews
Andrews

Posted on • Originally published at geekexcel.com on

Convert Chart into Image using Macros (VBA) in Excel Office 365!!

You can easily convert charts into images in Excel with the help of the Macros concept. Macros and VBA can provide a lot of features, so you can achieve your task with several clicks. In this tutorial, we will guide you to know the step-by-step instructions to Convert Chart into Image using Macros (VBA) in Excel Office 365.

Steps to Convert a Chart into Image:

To change a chart into an image, follow the below steps.

  • The below-given screenshot has shown the example chart that we have in our Excel, and we are going to convert it into an image.

Example chart
Example chart

  • On the Developer Tab, select the Visual Basic option under the Code section.

Select the Visual Basic option
Select the Visual Basic option

  • Then you need to copy and paste the code given below.

VBA code to change Chart into Image using Macros

‘Ensure that you have selected the chart

Sub ConvertChartIntoImage()

ActiveChart.ChartArea.Copy

ActiveSheet.Range(“A1”).Select

‘Change chart into the image

‘Then will be pasted on Cell A1

ActiveSheet.Pictures.Paste.Select

End Sub

  • You need to save the code by selecting it. Then close the window.

Save the code
Save the code

  • You have to open the sheet containing the data. On the Developer Tab, choose the Macros option in the Code section.

Choose the Macros option
Choose the Macros option

  • You need to make sure that your macro is selected and click the Run button.

Click Run button
Click Run button

  • Now, you will see that the selected chart has been changed into an image as shown in the below image.

Output image
Output image

Conclusion:

In this tutorial, we guided you to know the clear-cut steps to Convert Chart into Image using Macros (VBA) in Excel Office 365. Give your suggestions/feedback in the below comment section. Let us know if you have any queries regarding this tutorial. Thanks for visiting Geek Excel. Keep Learning!

Keep Reading:

Top comments (0)