+ Reply to Thread
Results 1 to 7 of 7

Opening multiple worksheets causes vba issues

  1. #1
    Registered User
    Join Date
    08-30-2014
    Location
    Lincoln, England
    MS-Off Ver
    Office 365
    Posts
    74

    Opening multiple worksheets causes vba issues

    When opening more than one workbook in Excel (latest Office 365 version) VBA code does not know which workbook it belongs to. For example, suppose you have two workbooks open and you switch from one to the other, perhaps using ALT-TAB. Any procedures or functions referring to a particular sheet will crash because it's looking in the active workbook, not the one it belongs to.
    Please Login or Register  to view this content.
    This is fine until another workbook has been opened at which point the code fails, even if this is the active one on screen. I understand that you could specify a workbook and sheet within a single function, but this isn't feasible when you have many functions using the simple Sheets command above - you would need to alter each one individually.

    Could someone tell me if there is a way around this on a global level so that when switching from workbook to workbook, the vba code knows which one it belongs to? Thank you.

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Opening multiple worksheets causes vba issues

    with your wb it'd be easier to help
    Last edited by tim201110; 08-10-2018 at 03:40 AM.

  3. #3
    Registered User
    Join Date
    08-30-2014
    Location
    Lincoln, England
    MS-Off Ver
    Office 365
    Posts
    74

    Re: Opening multiple worksheets causes vba issues

    Quote Originally Posted by tim201110 View Post
    with you wb it'd be easier to help
    Not sure what this means!

  4. #4
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Opening multiple worksheets causes vba issues

    Attach a workbook.

    Go Advanced -> manage Attachments -> Upload

  5. #5
    Registered User
    Join Date
    08-30-2014
    Location
    Lincoln, England
    MS-Off Ver
    Office 365
    Posts
    74

    Re: Opening multiple worksheets causes vba issues

    Quote Originally Posted by kersplash View Post
    Attach a workbook.

    Go Advanced -> manage Attachments -> Upload
    Ah, okay, but sorry, can't do that. It's a complex workbook with private information that could affect the destiny of the world...

  6. #6
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Opening multiple worksheets causes vba issues

    Don't need the entire workbook, just enough to demonstrate the issue.

  7. #7
    Registered User
    Join Date
    08-30-2014
    Location
    Lincoln, England
    MS-Off Ver
    Office 365
    Posts
    74

    Re: Opening multiple worksheets causes vba issues

    Apologies, I really can't do this. There are 20+ sheets in the workbook, all interconnected. Impossible to create a subset. It isn't a specific bug in one line of code. Switching to another workbook, for example via ALT-TAB, causes the initial workbook to fail at different points when I return to it, wherever there is a reference to a sheet or a form. Excel seems to lose focus and is looking for these sheets and forms in the wrong workbook.

+ 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. Issues formatting multiple synched worksheets
    By gngai in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-24-2017, 07:40 AM
  2. Opening multiple worksheets
    By reggie1000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2009, 08:25 AM
  3. Opening Multiple Worksheets
    By JesseH in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 03:05 AM
  4. [SOLVED] Opening Multiple Worksheets
    By JesseH in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 01:05 AM
  5. [SOLVED] Opening Multiple Worksheets
    By JesseH in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 12:05 AM
  6. [SOLVED] Opening Multiple Worksheets
    By JesseH in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-05-2005, 11:05 PM
  7. Opening Multiple Worksheets
    By JesseH in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-05-2005, 10:05 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