+ Reply to Thread
Results 1 to 3 of 3

Application.onkey, only active on specific sheets!

  1. #1
    Registered User
    Join Date
    09-04-2014
    Location
    Thailand
    MS-Off Ver
    2013
    Posts
    16

    Application.onkey, only active on specific sheets!

    Hi guy's,

    I have a workbook with lots of different sheets in it. In all of the sheets that I want people to be able to input information I have data validation, and sheet protection in place so people can only enter certain information...

    I have one sheet where i have SHAPES used as hyperlinks that i need people to move around feely across the sheet. I have 'unlocked the shapes' so when i lock the sheet, people can still move and play with them, but they can also DELETE them! (not very helpful as they are also hyperlinks!) I was wondering if there is an application.Onkey where i can disable the use of "{delete}" and "{backspace}" for this sheet only, and as soon as I the click on another sheet, the function to delete becomes availbe again? Then disabled when they click back on the sheet? etc. etc.

    They don't need to enter any information on the sheet I want to disable the delete function on, it's just a results viewing page so it doesn't matter about then not being able to delete things if they mess up!

    any help would be fantastic,

    thanks alot

    Thomas

  2. #2
    Registered User
    Join Date
    09-04-2014
    Location
    Thailand
    MS-Off Ver
    2013
    Posts
    16

    Re: Application.onkey, only active on specific sheets!

    I was hoping for something along the lines of putting in the sheet viewing code;

    Application.OnKey "{delete}"
    Application.OnKey "{backspace}"

    Then 'dissable macro once sheet has changed'??

  3. #3
    Registered User
    Join Date
    09-04-2014
    Location
    Thailand
    MS-Off Ver
    2013
    Posts
    16

    Re: Application.onkey, only active on specific sheets!

    Never mind, I've figured it out... for anyone who needs for their 'disabled key' to only work on a specific sheet, enter this into the sheet 'view code' when you right click it.

    Just change the 'delete' and 'backspace' to the buttons you want to toggle on and off

    pretty helpful page on the code names for buttons here too:
    http://msdn.microsoft.com/en-us/libr...ffice.15).aspx

    Private Sub Worksheet_Activate()
    Application.OnKey "{delete}", ""
    Application.OnKey "{backspace}", ""
    End Sub

    Private Sub Worksheet_Deactivate()
    Application.OnKey "{delete}"
    Application.OnKey "{backspace}"
    End Sub

+ 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. [SOLVED] Application.OnKey only in specific sheet
    By ZeljkoN in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-11-2013, 04:26 PM
  2. Application.OnKey key codes
    By ffffloyd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-15-2011, 09:28 AM
  3. Application.Onkey With SPACEBAR
    By Macdave_19 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-18-2008, 10:27 AM
  4. Key trapping without using Application.ONKEY
    By k483 in forum Excel General
    Replies: 0
    Last Post: 05-03-2005, 08:01 AM
  5. Application.OnKey
    By Kevin H. Stecyk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-26-2005, 10:07 PM

Tags for this Thread

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