Copy and paste chart format using VBA

VEVE4014

New Member
Joined
May 15, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,
Im stuck on VBA programing and im looking for help,
the goal of the program is to make a graph using a table in excel, then copy paste the format of an other graph to the new created graph.
As e beginer of VBA, i tried to look for help using AI and tutorials, with mixing them and some moddification i managed to get a program that does most of the job,
Unfortuntely, aplying the format to the new graph don't work.

There is no error so i don't know which part of the message don't work but i think its on copy pasting or on selecting the 1st graph

1715850449094.png
1715850516483.png


Thanks for any answer and help and i hope you have a good day
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I'm not 100% clear but maybe you could try the following.

1. Create your 'formatted' graph and right click on it.
2. Choose Save as Template... and save it with a name of your choice.
3. Create the new graph
4. On the Insert menu->Charts Group click on Recommended Charts->All Charts tab->Templates and select your template.
5. The template will be applied to your new graph.

Once you have that working properly then create another new graph, and repeat step 4 but this time use the macro recorder to record the steps of applying the template. Once you have the recorded code you could add it into your VBA code above.
 
Upvote 1
Solution
I'm not 100% clear but maybe you could try the following.

1. Create your 'formatted' graph and right click on it.
2. Choose Save as Template... and save it with a name of your choice.
3. Create the new graph
4. On the Insert menu->Charts Group click on Recommended Charts->All Charts tab->Templates and select your template.
5. The template will be applied to your new graph.

Once you have that working properly then create another new graph, and repeat step 4 but this time use the macro recorder to record the steps of applying the template. Once you have the recorded code you could add it into your VBA code above.
Thanks for your answer

i managed to make a code using your method and it work :)

beside i would rather like that the user don't need to save template but directly select the graph, atleast i have smth working now
and your method also have some adventage like making a librabry of template to have a faster and wider choice of format

Thank you for helping me anyways and sorry for late answser, i wish you to have a great day
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,777
Members
452,353
Latest member
strainu

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
Back
Top