ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how do I keep a macro with spreadsheet when moved (https://www.excelbanter.com/excel-discussion-misc-queries/16559-how-do-i-keep-macro-spreadsheet-when-moved.html)

SpeclAngel

how do I keep a macro with spreadsheet when moved
 
I am trying to keep a macro with a workbook when I move it from my laptop to
my desk computer. I have to redirect the macro everytime I move the workbook

Dave Peterson

It sounds like you're assigning the macro to a button/object/icon on a toolbar.

If that's the case, you may want to reassign the macro in code to the workbook
that owns the macro.

If you used a button from the Forms toolbar, a simple change may work for you.

Delete that button and use a commandbutton from the control toolbox toolbar.

Then double click on that commandbutton and have that code call your macro:

Option Explicit
Private Sub CommandButton1_Click()
Call myExistingMacro
End Sub


If you have trouble, you may want to post back with more details.

SpeclAngel wrote:

I am trying to keep a macro with a workbook when I move it from my laptop to
my desk computer. I have to redirect the macro everytime I move the workbook


--

Dave Peterson


All times are GMT +1. The time now is 12:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com