+ Reply to Thread
Results 1 to 3 of 3

Restrict Worksheet_Calculate() to its original worksheet !!!

  1. #1
    Carim
    Guest

    Restrict Worksheet_Calculate() to its original worksheet !!!

    Hi,

    I have to use worksheet calculate to fire a couple of macros.
    The problem is that, at a later stage, another workbook is opened, and
    worksheet_calculate() fires automatically in the newly opened workbook.
    So far, I had no success in adding a trap such as :
    If ActiveSheet.Name <>"xxxx" Then exit sub ...
    Any suggestions ???
    Thanks in advance
    Carim


  2. #2
    Bernie Deitrick
    Guest

    Re: Restrict Worksheet_Calculate() to its original worksheet !!!

    Carim,

    Add this to the top of your event code:
    Application.EnableEvents = False

    And this to the bottom:
    Application.EnableEvents = True

    Of course, that may prevent the auto_open macro or the workbook_open event
    of the workbook that you are opening from running, so there will be some
    further testing on your part involved.

    HTH,
    Bernie
    MS Excel MVP

    "Carim" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I have to use worksheet calculate to fire a couple of macros.
    > The problem is that, at a later stage, another workbook is opened, and
    > worksheet_calculate() fires automatically in the newly opened workbook.
    > So far, I had no success in adding a trap such as :
    > If ActiveSheet.Name <>"xxxx" Then exit sub ...
    > Any suggestions ???
    > Thanks in advance
    > Carim
    >




  3. #3
    Carim
    Guest

    Re: Restrict Worksheet_Calculate() to its original worksheet !!!

    Hi Bernie,

    It is already part of worksheet_calculate ...
    As a matter of fact, the very same module tested on an empty
    sheet/workbook works fine...
    The problem is that a pivot table object is in this sheet, which seems
    to disturb "normal behaviours" ...
    Thanks for your comments
    Cheers
    Carim


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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