Link to home
Start Free TrialLog in
Avatar of jagguy
jagguyFlag 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 ?
Avatar of rowanbooth
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.
Avatar of 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
You can edit your macros in the VisualBasic editor.  Within the macro code you can update the references to your current spreadsheet.
Avatar of 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.
post the workbook. you need to hold Control then click then right click. attach the workbook i will do it
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.
Avatar of 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
Avatar of Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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