#1   Report Post  
Bill Martin
 
Posts: n/a
Default Which Macro Runs...?

Over time I've accumulated a lot of macros I've written for various things. And
inevitably, sometimes they get the same Ctrl key assigned to them since they're
not expected to both be active at once.

Occasionally however I'll have one spreadsheet just parked in the background
while I quickly check or touch another. I keep getting screwed up when I try to
execute a macro on the active sheet, but one from the idle sheet executes
instead -- totally screwing up my active data.

It would seem there would be some way to tell Excel that when there's unexpected
conflict, just execute the macro from the active sheet. I haven't been able to
stumble into it however.

Is there a general solution to this general problem, or must I be more rigorous
in not assigning the same letter to two different macros in unrelated
spreadsheets? Which of course would beg the question what to do when more than
26 macros exist in my total Excel system...

Thanks...

Bill
  #2   Report Post  
Ernest Lai
 
Posts: n/a
Default

Not sure if I fully understand your problem.. it is a Friday afternoon after
all.

I assume you save your macros to file rather than to workbook. Either way I
would suggest not using keyboard shortcuts to execute macros. Use Alt + F8
to bring up the macro box and select the macro you wish to execute. If you
have to run more than 2 macros on the same sheet, you could write a macro to
execute X macros one after the other.

for example:

Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_1"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_2"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_3"
etc...

I havent tested this myself however...
If the macros are running on the wrong sheet because you have 2 or more
open. You could set your macros to only run on a specifically "named" sheet.
So if you do not rename a sheet it wont run.

Hope some of this helps you, if not I hope it was an interesting read.

Ernest

"Bill Martin" wrote:

Over time I've accumulated a lot of macros I've written for various things. And
inevitably, sometimes they get the same Ctrl key assigned to them since they're
not expected to both be active at once.

Occasionally however I'll have one spreadsheet just parked in the background
while I quickly check or touch another. I keep getting screwed up when I try to
execute a macro on the active sheet, but one from the idle sheet executes
instead -- totally screwing up my active data.

It would seem there would be some way to tell Excel that when there's unexpected
conflict, just execute the macro from the active sheet. I haven't been able to
stumble into it however.

Is there a general solution to this general problem, or must I be more rigorous
in not assigning the same letter to two different macros in unrelated
spreadsheets? Which of course would beg the question what to do when more than
26 macros exist in my total Excel system...

Thanks...

Bill

  #3   Report Post  
Bill Martin
 
Posts: n/a
Default

You're right -- that post was more ambiguous than intended. Let me be more
specific. The two macros are stored in two different workbooks. The macros are
stored in a module within the workbook from which they are intended to be executed.

One workbook is in the background unused at the moment, though loaded. When I
open up the second workbook for a quick use, that workbook has a macro which
randomly happens to have the same Ctrl key assigned. Somehow Excel seems to run
the first macro which was opened, rather than the one from the active workbook.

When I have macros which will be used widely I keep them in a common library
workbook and do not have conflicted assignments. The ones which are only
intended for use private in a particular workbook are kept in the relevant workbook.

Bill
---------------------

Ernest Lai wrote:
Not sure if I fully understand your problem.. it is a Friday afternoon after
all.

I assume you save your macros to file rather than to workbook. Either way I
would suggest not using keyboard shortcuts to execute macros. Use Alt + F8
to bring up the macro box and select the macro you wish to execute. If you
have to run more than 2 macros on the same sheet, you could write a macro to
execute X macros one after the other.

for example:

Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_1"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_2"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_3"
etc...

I havent tested this myself however...
If the macros are running on the wrong sheet because you have 2 or more
open. You could set your macros to only run on a specifically "named" sheet.
So if you do not rename a sheet it wont run.

Hope some of this helps you, if not I hope it was an interesting read.

Ernest

"Bill Martin" wrote:


Over time I've accumulated a lot of macros I've written for various things. And
inevitably, sometimes they get the same Ctrl key assigned to them since they're
not expected to both be active at once.

Occasionally however I'll have one spreadsheet just parked in the background
while I quickly check or touch another. I keep getting screwed up when I try to
execute a macro on the active sheet, but one from the idle sheet executes
instead -- totally screwing up my active data.

It would seem there would be some way to tell Excel that when there's unexpected
conflict, just execute the macro from the active sheet. I haven't been able to
stumble into it however.

Is there a general solution to this general problem, or must I be more rigorous
in not assigning the same letter to two different macros in unrelated
spreadsheets? Which of course would beg the question what to do when more than
26 macros exist in my total Excel system...

Thanks...

Bill

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

When you assign the shortcut key to that macro, it's an application level
shortcut.

I would think the safest thing to do would be to either use separate shortcut
keys or give the user some other way to run the macro (a toolbar?).

Bill Martin wrote:

You're right -- that post was more ambiguous than intended. Let me be more
specific. The two macros are stored in two different workbooks. The macros are
stored in a module within the workbook from which they are intended to be executed.

One workbook is in the background unused at the moment, though loaded. When I
open up the second workbook for a quick use, that workbook has a macro which
randomly happens to have the same Ctrl key assigned. Somehow Excel seems to run
the first macro which was opened, rather than the one from the active workbook.

When I have macros which will be used widely I keep them in a common library
workbook and do not have conflicted assignments. The ones which are only
intended for use private in a particular workbook are kept in the relevant workbook.

Bill
---------------------

Ernest Lai wrote:
Not sure if I fully understand your problem.. it is a Friday afternoon after
all.

I assume you save your macros to file rather than to workbook. Either way I
would suggest not using keyboard shortcuts to execute macros. Use Alt + F8
to bring up the macro box and select the macro you wish to execute. If you
have to run more than 2 macros on the same sheet, you could write a macro to
execute X macros one after the other.

for example:

Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_1"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_2"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_3"
etc...

I havent tested this myself however...
If the macros are running on the wrong sheet because you have 2 or more
open. You could set your macros to only run on a specifically "named" sheet.
So if you do not rename a sheet it wont run.

Hope some of this helps you, if not I hope it was an interesting read.

Ernest

"Bill Martin" wrote:


Over time I've accumulated a lot of macros I've written for various things. And
inevitably, sometimes they get the same Ctrl key assigned to them since they're
not expected to both be active at once.

Occasionally however I'll have one spreadsheet just parked in the background
while I quickly check or touch another. I keep getting screwed up when I try to
execute a macro on the active sheet, but one from the idle sheet executes
instead -- totally screwing up my active data.

It would seem there would be some way to tell Excel that when there's unexpected
conflict, just execute the macro from the active sheet. I haven't been able to
stumble into it however.

Is there a general solution to this general problem, or must I be more rigorous
in not assigning the same letter to two different macros in unrelated
spreadsheets? Which of course would beg the question what to do when more than
26 macros exist in my total Excel system...

Thanks...

Bill


--

Dave Peterson
  #5   Report Post  
Bill Martin
 
Posts: n/a
Default

It sounds like I'll need to troll through VBA to find a way to automagically
assign particular macros to a toolbar when that particular workbook is active.
Rather than always having access to a huge tool bar whose individual elements
are rarely used.

Thanks...

Bill

-----------------------------

Dave Peterson wrote:
When you assign the shortcut key to that macro, it's an application level
shortcut.

I would think the safest thing to do would be to either use separate shortcut
keys or give the user some other way to run the macro (a toolbar?).

Bill Martin wrote:

You're right -- that post was more ambiguous than intended. Let me be more
specific. The two macros are stored in two different workbooks. The macros are
stored in a module within the workbook from which they are intended to be executed.

One workbook is in the background unused at the moment, though loaded. When I
open up the second workbook for a quick use, that workbook has a macro which
randomly happens to have the same Ctrl key assigned. Somehow Excel seems to run
the first macro which was opened, rather than the one from the active workbook.

When I have macros which will be used widely I keep them in a common library
workbook and do not have conflicted assignments. The ones which are only
intended for use private in a particular workbook are kept in the relevant workbook.

Bill
---------------------

Ernest Lai wrote:

Not sure if I fully understand your problem.. it is a Friday afternoon after
all.

I assume you save your macros to file rather than to workbook. Either way I
would suggest not using keyboard shortcuts to execute macros. Use Alt + F8
to bring up the macro box and select the macro you wish to execute. If you
have to run more than 2 macros on the same sheet, you could write a macro to
execute X macros one after the other.

for example:

Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_1"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_2"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_3"
etc...

I havent tested this myself however...
If the macros are running on the wrong sheet because you have 2 or more
open. You could set your macros to only run on a specifically "named" sheet.
So if you do not rename a sheet it wont run.

Hope some of this helps you, if not I hope it was an interesting read.

Ernest

"Bill Martin" wrote:



Over time I've accumulated a lot of macros I've written for various things. And
inevitably, sometimes they get the same Ctrl key assigned to them since they're
not expected to both be active at once.

Occasionally however I'll have one spreadsheet just parked in the background
while I quickly check or touch another. I keep getting screwed up when I try to
execute a macro on the active sheet, but one from the idle sheet executes
instead -- totally screwing up my active data.

It would seem there would be some way to tell Excel that when there's unexpected
conflict, just execute the macro from the active sheet. I haven't been able to
stumble into it however.

Is there a general solution to this general problem, or must I be more rigorous
in not assigning the same letter to two different macros in unrelated
spreadsheets? Which of course would beg the question what to do when more than
26 macros exist in my total Excel system...

Thanks...

Bill





  #6   Report Post  
Dave Peterson
 
Posts: n/a
Default

I like John Walkenbach's menumaker:
http://j-walk.com/ss/excel/tips/tip53.htm

I can categorize my macros and then "bury" them deeper.

Kind of like tools|Macro|macros...

Bill Martin wrote:

It sounds like I'll need to troll through VBA to find a way to automagically
assign particular macros to a toolbar when that particular workbook is active.
Rather than always having access to a huge tool bar whose individual elements
are rarely used.

Thanks...

Bill

-----------------------------

Dave Peterson wrote:
When you assign the shortcut key to that macro, it's an application level
shortcut.

I would think the safest thing to do would be to either use separate shortcut
keys or give the user some other way to run the macro (a toolbar?).

Bill Martin wrote:

You're right -- that post was more ambiguous than intended. Let me be more
specific. The two macros are stored in two different workbooks. The macros are
stored in a module within the workbook from which they are intended to be executed.

One workbook is in the background unused at the moment, though loaded. When I
open up the second workbook for a quick use, that workbook has a macro which
randomly happens to have the same Ctrl key assigned. Somehow Excel seems to run
the first macro which was opened, rather than the one from the active workbook.

When I have macros which will be used widely I keep them in a common library
workbook and do not have conflicted assignments. The ones which are only
intended for use private in a particular workbook are kept in the relevant workbook.

Bill
---------------------

Ernest Lai wrote:

Not sure if I fully understand your problem.. it is a Friday afternoon after
all.

I assume you save your macros to file rather than to workbook. Either way I
would suggest not using keyboard shortcuts to execute macros. Use Alt + F8
to bring up the macro box and select the macro you wish to execute. If you
have to run more than 2 macros on the same sheet, you could write a macro to
execute X macros one after the other.

for example:

Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_1"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_2"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_3"
etc...

I havent tested this myself however...
If the macros are running on the wrong sheet because you have 2 or more
open. You could set your macros to only run on a specifically "named" sheet.
So if you do not rename a sheet it wont run.

Hope some of this helps you, if not I hope it was an interesting read.

Ernest

"Bill Martin" wrote:



Over time I've accumulated a lot of macros I've written for various things. And
inevitably, sometimes they get the same Ctrl key assigned to them since they're
not expected to both be active at once.

Occasionally however I'll have one spreadsheet just parked in the background
while I quickly check or touch another. I keep getting screwed up when I try to
execute a macro on the active sheet, but one from the idle sheet executes
instead -- totally screwing up my active data.

It would seem there would be some way to tell Excel that when there's unexpected
conflict, just execute the macro from the active sheet. I haven't been able to
stumble into it however.

Is there a general solution to this general problem, or must I be more rigorous
in not assigning the same letter to two different macros in unrelated
spreadsheets? Which of course would beg the question what to do when more than
26 macros exist in my total Excel system...

Thanks...

Bill




--

Dave Peterson
  #7   Report Post  
Bill Martin
 
Posts: n/a
Default

Thanks ... I'll look into that. In the mean time I figured out how to add a
couple of buttons to a tool bar only while the particular spreadsheet is active.
I'll play with that approach a bit to see how convenient I find it with real
usage experience.

Bill
------------------------
Dave Peterson wrote:
I like John Walkenbach's menumaker:
http://j-walk.com/ss/excel/tips/tip53.htm

I can categorize my macros and then "bury" them deeper.

Kind of like tools|Macro|macros...

Bill Martin wrote:

It sounds like I'll need to troll through VBA to find a way to automagically
assign particular macros to a toolbar when that particular workbook is active.
Rather than always having access to a huge tool bar whose individual elements
are rarely used.

Thanks...

Bill

-----------------------------

Dave Peterson wrote:

When you assign the shortcut key to that macro, it's an application level
shortcut.

I would think the safest thing to do would be to either use separate shortcut
keys or give the user some other way to run the macro (a toolbar?).

Bill Martin wrote:


You're right -- that post was more ambiguous than intended. Let me be more
specific. The two macros are stored in two different workbooks. The macros are
stored in a module within the workbook from which they are intended to be executed.

One workbook is in the background unused at the moment, though loaded. When I
open up the second workbook for a quick use, that workbook has a macro which
randomly happens to have the same Ctrl key assigned. Somehow Excel seems to run
the first macro which was opened, rather than the one from the active workbook.

When I have macros which will be used widely I keep them in a common library
workbook and do not have conflicted assignments. The ones which are only
intended for use private in a particular workbook are kept in the relevant workbook.

Bill
---------------------

Ernest Lai wrote:


Not sure if I fully understand your problem.. it is a Friday afternoon after
all.

I assume you save your macros to file rather than to workbook. Either way I
would suggest not using keyboard shortcuts to execute macros. Use Alt + F8
to bring up the macro box and select the macro you wish to execute. If you
have to run more than 2 macros on the same sheet, you could write a macro to
execute X macros one after the other.

for example:

Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_1"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_2"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_3"
etc...

I havent tested this myself however...
If the macros are running on the wrong sheet because you have 2 or more
open. You could set your macros to only run on a specifically "named" sheet.
So if you do not rename a sheet it wont run.

Hope some of this helps you, if not I hope it was an interesting read.

Ernest

"Bill Martin" wrote:




Over time I've accumulated a lot of macros I've written for various things. And
inevitably, sometimes they get the same Ctrl key assigned to them since they're
not expected to both be active at once.

Occasionally however I'll have one spreadsheet just parked in the background
while I quickly check or touch another. I keep getting screwed up when I try to
execute a macro on the active sheet, but one from the idle sheet executes
instead -- totally screwing up my active data.

It would seem there would be some way to tell Excel that when there's unexpected
conflict, just execute the macro from the active sheet. I haven't been able to
stumble into it however.

Is there a general solution to this general problem, or must I be more rigorous
in not assigning the same letter to two different macros in unrelated
spreadsheets? Which of course would beg the question what to do when more than
26 macros exist in my total Excel system...

Thanks...

Bill




  #8   Report Post  
Ernest Lai
 
Posts: n/a
Default

Interesting, a menu system. Would be handy as I run several macros on the
same original set of data.

Going to save this thread for later.

Ernest

"Bill Martin" wrote:

Thanks ... I'll look into that. In the mean time I figured out how to add a
couple of buttons to a tool bar only while the particular spreadsheet is active.
I'll play with that approach a bit to see how convenient I find it with real
usage experience.

Bill
------------------------
Dave Peterson wrote:
I like John Walkenbach's menumaker:
http://j-walk.com/ss/excel/tips/tip53.htm

I can categorize my macros and then "bury" them deeper.

Kind of like tools|Macro|macros...

Bill Martin wrote:

It sounds like I'll need to troll through VBA to find a way to automagically
assign particular macros to a toolbar when that particular workbook is active.
Rather than always having access to a huge tool bar whose individual elements
are rarely used.

Thanks...

Bill

-----------------------------

Dave Peterson wrote:

When you assign the shortcut key to that macro, it's an application level
shortcut.

I would think the safest thing to do would be to either use separate shortcut
keys or give the user some other way to run the macro (a toolbar?).

Bill Martin wrote:


You're right -- that post was more ambiguous than intended. Let me be more
specific. The two macros are stored in two different workbooks. The macros are
stored in a module within the workbook from which they are intended to be executed.

One workbook is in the background unused at the moment, though loaded. When I
open up the second workbook for a quick use, that workbook has a macro which
randomly happens to have the same Ctrl key assigned. Somehow Excel seems to run
the first macro which was opened, rather than the one from the active workbook.

When I have macros which will be used widely I keep them in a common library
workbook and do not have conflicted assignments. The ones which are only
intended for use private in a particular workbook are kept in the relevant workbook.

Bill
---------------------

Ernest Lai wrote:


Not sure if I fully understand your problem.. it is a Friday afternoon after
all.

I assume you save your macros to file rather than to workbook. Either way I
would suggest not using keyboard shortcuts to execute macros. Use Alt + F8
to bring up the macro box and select the macro you wish to execute. If you
have to run more than 2 macros on the same sheet, you could write a macro to
execute X macros one after the other.

for example:

Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_1"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_2"
Application.Run "'Macro for xxxxxxxx.xls'!z_DONT_TOUCH_ME_3"
etc...

I havent tested this myself however...
If the macros are running on the wrong sheet because you have 2 or more
open. You could set your macros to only run on a specifically "named" sheet.
So if you do not rename a sheet it wont run.

Hope some of this helps you, if not I hope it was an interesting read.

Ernest

"Bill Martin" wrote:




Over time I've accumulated a lot of macros I've written for various things. And
inevitably, sometimes they get the same Ctrl key assigned to them since they're
not expected to both be active at once.

Occasionally however I'll have one spreadsheet just parked in the background
while I quickly check or touch another. I keep getting screwed up when I try to
execute a macro on the active sheet, but one from the idle sheet executes
instead -- totally screwing up my active data.

It would seem there would be some way to tell Excel that when there's unexpected
conflict, just execute the macro from the active sheet. I haven't been able to
stumble into it however.

Is there a general solution to this general problem, or must I be more rigorous
in not assigning the same letter to two different macros in unrelated
spreadsheets? Which of course would beg the question what to do when more than
26 macros exist in my total Excel system...

Thanks...

Bill





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
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro for multiple charts JS Excel Worksheet Functions 1 November 19th 04 03:44 AM


All times are GMT +1. The time now is 01:07 PM.

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"