Remove On Activate Sheet Event

R

rcl2884

I have an Excel workbook that I inherited that wants to run an event
every time I activate or deactivate a sheet. I cannot seem to locate
the worksheet events so that I can disable this. There are two
subroutines with names like "OnActivateSheetName" and
"OnDeactivateSheetName". If I simply remove these routines I get a
message that says that these subroutines cannot be found, whenever I
activate (or deactivate) the sheet.

How do I remove this "event" requirement?

Thanks,
Rick
 
M

Matthew Pfluger

You are close. If you press Ctrl+R to bring up the Project Explorer, scroll
through the list until you find your project. Expand the [+] sign next to
the name, and you'll see some folders. One will be called "Microsoft Excel
Objects"; click the [+] to expand that folder. You'll see objects for each
worksheet in the workbook and one object representing the workbook itself.

Worksheet events are stored in these special code modules. Simply double
click on the object that represents the worksheet you are working in. Then,
find and delete all macros (events).

HTH,
Matthew Pfluger
 
P

PCLIVE

Double-Click on 'ThisWorkbook". You'll probably find the calling code
there.

HTH,
Paul
 
R

rcl2884

Matthew,
Thanks for the suggestion. When I double-click on the worksheet, I get
two tabs.. one identified as "general" is blank (no code) while the
other identified as "worksheet" has the following code

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

over to the right is a selection of possible events. When I click on
Activate, it creates the code

Private Sub Worksheet_Activate()

End Sub

The action of the workbook is the same whether or not this code is
present. Is there somewhere else where action on this event could be
specified? I am currently using Excel 2003, but I believe the sheet
was originally created in Excel 1997.

Paul writes
"Double-Click on 'ThisWorkbook". You'll probably find the calling
code
there."

There are a lot of properties, but none that seems to correspond to
what I am looking for.

Just to clarify, I know where the codes that gets called is... I just
want to stop the sheet from calling that code. Mainly it is a problem
when I am debugging and jumping from sheet to sheet because I get
error messages saying it cannot process the "OnActivateSheet" macro
while in DeBug mode.

Thanks again, for the help.
...Rick









You are close.  If you press Ctrl+R to bring up the Project Explorer, scroll
through the list until you find your project.  Expand the [+] sign next to
the name, and you'll see some folders.  One will be called "Microsoft Excel
Objects"; click the [+] to expand that folder.  You'll see objects for each
worksheet in the workbook and one object representing the workbook itself. 

Worksheet events are stored in these special code modules.  Simply double
click on the object that represents the worksheet you are working in.  Then,
find and delete all macros (events).

HTH,
Matthew Pfluger



rcl2884 said:
I have an Excel workbook that I inherited that wants to run an event
every time I activate or deactivate a sheet. I cannot seem to locate
the worksheet events so that I can disable this. There are two
subroutines with names like "OnActivateSheetName" and
"OnDeactivateSheetName". If I simply remove these routines I get a
message that says that these subroutines cannot be found, whenever I
activate (or deactivate) the sheet.
How do I remove this "event" requirement?
Thanks,
Rick- Hide quoted text -

- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top