Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Location
    NJ
    Posts
    139

    Unanswered: Application.OnKey

    Hi,

    Excel 97

    I have written a small excel program that works well in sheet one, but when I got to sheet two, it does not work.

    I have these lines in all sheets Activate events and when I load the workbook, sheet one works, but sheet two and three don't. Any thoughts?

    Private Sub Worksheet_Activate()
    Application.OnKey "{Return}"
    Application.OnKey "{Enter}", "AMPM"

    End Sub

    Private Sub Worksheet_Deactivate()
    Application.OnKey "{Return}"
    Application.OnKey "{Enter}"
    End Sub

  2. #2
    Join Date
    Feb 2002
    Posts
    8
    Use the Workbook (ThisWorkbook) object instead of the Worksheet. You can use the workbook functions "SheetActivate" and "SheetDeactivate" to perform the action on all sheets in the book.

    Dave.

Posting Permissions

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