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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

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
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,112
Messages
5,768,167
Members
425,458
Latest member
Jaspal1996

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