I have an Excel with two sheets, Form and DATA, and I designed a form in the Form sheet.

My data is in A1:B10 and D1:E10 in the DATA sheet.

I put two command buttons in the Form sheet whose names are cmdButtonChart1 for the chart related to A1:B10 and cmdButtonChart2 for the chart related to D1:E10.

My goal is that when each button is pressed, the previous chart will be hidden and the bar chart corresponding to that button will be displayed in the Form sheet.

Until now, I have not written the commands related to chart in VBA. Please help me to write that.

Asked this Q in this place.

Thanks in advance.