#1   Report Post  
MWSoccer18
 
Posts: n/a
Default Macro Shortcut Key

If you have 2 Excel files open which both have macro's named the same and
assigned to the same shortcut key...it does not execute the current sheet's
macro. It runs the other sheets macro because it is listed first in the
global macro listing.
Is there a way to make it run the macro from the workbook that you are in?

ex.
I have 2 files...one called Test1.xls and the other Test2.xls....both having
Macro's assigned to ctrl+shift+Z. If I'm in Test2.xls....it will run the
Test1.xls macro.

Macro List
---------------------------
Test1.xls!Macro1
Macro1


  #2   Report Post  
Henry
 
Posts: n/a
Default

MWSoccer18,

Try changing one of the macro names and, of course, the code for the
associated button.

Henry


"MWSoccer18" wrote in message
...
If you have 2 Excel files open which both have macro's named the same and
assigned to the same shortcut key...it does not execute the current
sheet's
macro. It runs the other sheets macro because it is listed first in the
global macro listing.
Is there a way to make it run the macro from the workbook that you are in?

ex.
I have 2 files...one called Test1.xls and the other Test2.xls....both
having
Macro's assigned to ctrl+shift+Z. If I'm in Test2.xls....it will run the
Test1.xls macro.

Macro List
---------------------------
Test1.xls!Macro1
Macro1




  #3   Report Post  
MWSoccer18
 
Posts: n/a
Default

There is no button involved. The macro is always executed through a
ctrl+shift+Z combination. Changing the macro name will only work if the
macro name in the current sheet alphabetically comes before the macro in the
other sheet. But then...when you switch back to the other sheet...you will
be executing the wrong macro in that sheet.

"Henry" wrote:

MWSoccer18,

Try changing one of the macro names and, of course, the code for the
associated button.

Henry


"MWSoccer18" wrote in message
...
If you have 2 Excel files open which both have macro's named the same and
assigned to the same shortcut key...it does not execute the current
sheet's
macro. It runs the other sheets macro because it is listed first in the
global macro listing.
Is there a way to make it run the macro from the workbook that you are in?

ex.
I have 2 files...one called Test1.xls and the other Test2.xls....both
having
Macro's assigned to ctrl+shift+Z. If I'm in Test2.xls....it will run the
Test1.xls macro.

Macro List
---------------------------
Test1.xls!Macro1
Macro1





  #4   Report Post  
Henry
 
Posts: n/a
Default

MWSoccer18,

Different shortcut combinations?

Or
In a module put this sub.

Private Sub Chooser()

If Sheets("Sheet1") = ActiveSheet Then
Call test1
Else
Call test2
End If
End Sub

Use your shortcut combination to call Sub Chooser()

Henry


"MWSoccer18" wrote in message
...
There is no button involved. The macro is always executed through a
ctrl+shift+Z combination. Changing the macro name will only work if the
macro name in the current sheet alphabetically comes before the macro in
the
other sheet. But then...when you switch back to the other sheet...you
will
be executing the wrong macro in that sheet.

"Henry" wrote:

MWSoccer18,

Try changing one of the macro names and, of course, the code for the
associated button.

Henry


"MWSoccer18" wrote in message
...
If you have 2 Excel files open which both have macro's named the same
and
assigned to the same shortcut key...it does not execute the current
sheet's
macro. It runs the other sheets macro because it is listed first in
the
global macro listing.
Is there a way to make it run the macro from the workbook that you are
in?

ex.
I have 2 files...one called Test1.xls and the other Test2.xls....both
having
Macro's assigned to ctrl+shift+Z. If I'm in Test2.xls....it will run
the
Test1.xls macro.

Macro List
---------------------------
Test1.xls!Macro1
Macro1







  #5   Report Post  
MWSoccer18
 
Posts: n/a
Default

OK....that is a good way to get around it...but...what if the macro names are
the same? Here's the problem...We have several revisions of a "cost sheet".
All the macro names are the same because the master is a template that just
gets revised over time. Someone could have 3 or 4 of these files open at
once with different revisions of the macro in each file....but the same macro
name and shortcut key. So when a shortcut key is pressed...the first macro
listed in the Macro List will take precedence.

"Henry" wrote:

MWSoccer18,

Different shortcut combinations?

Or
In a module put this sub.

Private Sub Chooser()

If Sheets("Sheet1") = ActiveSheet Then
Call test1
Else
Call test2
End If
End Sub

Use your shortcut combination to call Sub Chooser()

Henry


"MWSoccer18" wrote in message
...
There is no button involved. The macro is always executed through a
ctrl+shift+Z combination. Changing the macro name will only work if the
macro name in the current sheet alphabetically comes before the macro in
the
other sheet. But then...when you switch back to the other sheet...you
will
be executing the wrong macro in that sheet.

"Henry" wrote:

MWSoccer18,

Try changing one of the macro names and, of course, the code for the
associated button.

Henry


"MWSoccer18" wrote in message
...
If you have 2 Excel files open which both have macro's named the same
and
assigned to the same shortcut key...it does not execute the current
sheet's
macro. It runs the other sheets macro because it is listed first in
the
global macro listing.
Is there a way to make it run the macro from the workbook that you are
in?

ex.
I have 2 files...one called Test1.xls and the other Test2.xls....both
having
Macro's assigned to ctrl+shift+Z. If I'm in Test2.xls....it will run
the
Test1.xls macro.

Macro List
---------------------------
Test1.xls!Macro1
Macro1








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Macro and sub rountines The Good Deeds Team Excel Discussion (Misc queries) 1 March 23rd 05 11:26 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro Shortcut Keys Nicolle K. Excel Discussion (Misc queries) 1 January 6th 05 04:55 PM
macro code shortcut Brian Excel Worksheet Functions 4 December 15th 04 08:59 PM


All times are GMT +1. The time now is 11:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"