Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Macro shortcuts are running macros in different open workbook

I use the same macro shortcuts in different workbooks. Sometimes the
shortcuts run the same macro and act on the active worksheet. In those
cases if the shortcut runs the macro from a non-active workbook it will
still work. But one of the shortcuts has a different meaning in another
workbook, and if the shortcut decides to run the macro in that workbook
then it doesn't work.

When I use a shortcut how do I get it to run the macro in the active
workbook?

Don. www.donwiss.com (e-mail link at home page bottom).
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Macro shortcuts are running macros in different open workbook

Don Wiss brought next idea :
I use the same macro shortcuts in different workbooks. Sometimes the
shortcuts run the same macro and act on the active worksheet. In those
cases if the shortcut runs the macro from a non-active workbook it will
still work. But one of the shortcuts has a different meaning in another
workbook, and if the shortcut decides to run the macro in that workbook
then it doesn't work.

When I use a shortcut how do I get it to run the macro in the active
workbook?

Don. www.donwiss.com (e-mail link at home page bottom).


Excel exhibits some bizarre behavior if macros are assigned the same
shortcuts or if 2 files with macros of the same name are open. The
behhavior varies depending on the order the files containing the macros
were opened. <IIRCNormally the active shortcuts belong to the current
active file if it has macros, otherwise the last active file containing
macros.

So if 2 open files use the same shortcut to run a macro, the 1st file
that uses the shortcut will run its associated macro. It's usually
better to assign macros to a button or menuitem AND use this statement
at the top of each code module...

Option Private Module
Option Explicit

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Macro shortcuts are running macros in different open workbook

On Sat, 24 Mar 2012 01:58:24 -0400, GS wrote:

Don Wiss brought next idea :
I use the same macro shortcuts in different workbooks. Sometimes the
shortcuts run the same macro and act on the active worksheet. In those
cases if the shortcut runs the macro from a non-active workbook it will
still work. But one of the shortcuts has a different meaning in another
workbook, and if the shortcut decides to run the macro in that workbook
then it doesn't work.

When I use a shortcut how do I get it to run the macro in the active
workbook?


Excel exhibits some bizarre behavior if macros are assigned the same
shortcuts or if 2 files with macros of the same name are open. The
behhavior varies depending on the order the files containing the macros
were opened. <IIRCNormally the active shortcuts belong to the current
active file if it has macros, otherwise the last active file containing
macros.

So if 2 open files use the same shortcut to run a macro, the 1st file
that uses the shortcut will run its associated macro. It's usually
better to assign macros to a button or menuitem AND use this statement
at the top of each code module...


It has to be a keyboard macro, as it gets data from the ActiveCell.Row and
puts a string into the clipboard. There are three macros, each putting
different strings into the clipboard. The two spreadsheets are similar,
with ISBN numbers in column B.

I removed the shortcut in the other different workbook that was the same. I
thought about it and realized that it was no longer needed. So now it
doesn't matter which macro it runs, as they are identical and only read
column B of the ActiveCell.Row.

Option Private Module
Option Explicit


I am using Excel 97. I have always used Option Explicit. I have never used
Option Private Module.

Don. www.donwiss.com (e-mail link at home page bottom).
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Macro shortcuts are running macros in different open workbook

On Sat, 24 Mar 2012 05:10:06 -0400, Don Wiss wrote:

I am using Excel 97.


Correction. It is Excel 2002.

Don. www.donwiss.com (e-mail link at home page bottom).
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
Open workbook from code without running macros Ian[_4_] Excel Programming 2 October 24th 07 07:48 AM
Open workbook from code without running macros Ian[_4_] Excel Programming 2 October 23rd 07 07:05 PM
Running macro on open of workbook? Lime Excel Programming 5 June 14th 06 06:41 PM
Open workbook without running Macros Raul[_2_] Excel Programming 2 May 27th 06 02:51 PM
macro not running on workbook open Nick Smith[_2_] Excel Programming 4 May 11th 06 10:24 AM


All times are GMT +1. The time now is 09:30 AM.

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

About Us

"It's about Microsoft Excel"