Avatar of jagguy
jagguy
Flag for Australia asked on

copy macros

Hi,

I have a whole set of macros I created in Book1.xls and I copied them all to Book2.xls.The macros are attached to buttons.

The button macros in Book2.xls dont work because they point to Book1.xls and what can i do so i dont need to recreate them all again. How do I copy macros over ?
Microsoft ExcelVB Script

Avatar of undefined
Last Comment
jagguy

8/22/2022 - Mon
rowanbooth

You will need to asign the macros to the buttons again. close book the other workbook first. hold control and right click to do this.
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

Hello Jagguy,
close all workbooks but book2.xls. Then right-click each button in turn and assign the macro from the current workbook.
regards
teylyn
markdmac

You can edit your macros in the VisualBasic editor.  Within the macro code you can update the references to your current spreadsheet.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
jagguy

ASKER
I cant edit the macro name I am not sure what you mean. Everytime I click on the macro the other workbook opens.
rowanbooth

post the workbook. you need to hold Control then click then right click. attach the workbook i will do it
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

If your buttons have been created with the Forms toolbar, then you can right-click on them and select "Assign macro" from the context menu.
If the buttons have been created with the Control toolbar, then they will have code associated with them that resides in the code module. Make sure to copy all the code for these buttons and then check the macro references in the button control code.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
jagguy

ASKER
you will find macros assigned to the button and the first sheet works but others are assigned to old workbook.
ClassRoll2.xls
ASKER CERTIFIED SOLUTION
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
jagguy

ASKER
Yes I just have 1 macro and all it does is display 'x' in all rows below it. I just thought there was quicker way or I mucked up what you said. Sounds like I will need to do it all manually