View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default A negative to using Application.Onkey

Set the key on the worbook activate event, and reset it on the workbook
deactivate event.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Andybro" wrote in message
...
I have programmed an excel spreadsheet to activate a macro when the ENTER
button is pressed using the Application.Onkey command.

My problem is that if I then open another excel spreadsheet, and I press
ENTER, then the macro for the 1st speadsheet tries to run.

Is there a way to ensure that this macro runs only in the specific
speadsheet and not in every speadsheet I have open?

NB/ I have currently written the onkey command into Sheet1 of Microsoft
Excel Objects for the speadsheet.

Thanks