Macro Recorder doesn't record Design/Select Data

VBAProIWish

Well-known Member
Joined
Jul 6, 2009
Messages
980
Hello All,

I used the macro recorder to record the following...(recorded code below)

1. Select a chart
2. Select "Design" in the ribbon
3. Select "Select Data"
4. Select my desired data range
5. Press ok
6. Insert a template

However, the only part that's recorded is selecting the chart and inserting a template.
The recorder completely ignored steps 2-5.
Does anyone know why?

VBA Code:
   Sheets("Slide 1").Select
    ActiveSheet.ChartObjects("Chart 1").Activate
    Application.CutCopyMode = False
    ActiveChart.ApplyChartTemplate ("C:\Charts\_Slide 1.crtx")

Thanks much
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

EFANYoutube

Active Member
Joined
May 19, 2017
Messages
278
Hi
Please try adding the below
Code:
ActiveSheet.ChartObjects("Chart 1").SetSourceData Source:=Sheets(1).Range("A1:A10"), PlotBy:=xlColumns

Also, its a good idea to learn how to code explicitly as the code created by the recorder can have undesired consequenses

 
Solution
Learn Excel from Bill Jelen

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

Forum statistics

Threads
1,151,611
Messages
5,765,415
Members
425,286
Latest member
CazzaBabes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top