+ Reply to Thread
Results 1 to 2 of 2

Macro on two open workbooks?

  1. #1
    Forum Contributor
    Join Date
    01-16-2011
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2010
    Posts
    234

    Macro on two open workbooks?

    I have a project that requires two open linked workbooks. One workbook has a number of macros assigned to CTRL- shortcuts.

    How can I make each macro only work on one workbook? If I have the second workbook selected and implement a macro shortcut that is intended for the first workbook, Excel tries to apply the macro to the second workbook.

    Is there a way to insure that a macro only works on the intended workbook?

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Macro on two open workbooks?

    Hi, Hambone70,

    make use of ThisWorkbook for any sheets and ranges to limit the use to the workbook with code - if nothing has been set the macrtos would run on the ActiveWorkbook.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to Open Up Workbooks
    By hyattj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2013, 12:35 PM
  2. Looking to execute macro on all open workbooks
    By HooligaD in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-29-2012, 12:47 PM
  3. open two workbooks from one macro
    By excellentexcel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-06-2009, 03:08 AM
  4. Macro to save all open workbooks
    By ForSale in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-03-2007, 10:39 PM
  5. workbooks.open stops the macro
    By leevi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-09-2007, 12:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1