+ Reply to Thread
Results 1 to 6 of 6

application.onkey depending on a if function.

  1. #1
    Registered User
    Join Date
    04-25-2012
    Location
    Curacao
    MS-Off Ver
    Excel 2003
    Posts
    18

    application.onkey depending on a if function.

    Dear excel friends,

    My challenge is to find out the following:

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    does the "application OnKey" works as well depending on an if function? In case the sheet is unprotected, the delete button should be used to clear the cell contents.

    Hope you can help me out.

    kind regards,
    Last edited by TravelDrome; 09-03-2012 at 02:10 PM.

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: application.onkey depending on a if function.

    Something like

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-25-2012
    Location
    Curacao
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: application.onkey depending on a if function.

    Dear Jason.b75

    your code says something like " if the contents of the cell are protected, i hit a key and the selection will be deleted".

    However I would like the following. When i hit the delete button and the worksheet is protected, not the workbook, there should pop up a userform asking "Are you sure you want to unlock the sheet" with a button "yes" and "no". In case you push "yes", the sheet will be unprotected. In case "no" you go back without any act.
    When the sheet is unprotected, the userform shouldn t pop up and the delete button should be used for deleting the cell contents.

    regards marc

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: application.onkey depending on a if function.

    Try

    Workbook module
    Please Login or Register  to view this content.
    Standard module
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-25-2012
    Location
    Curacao
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: application.onkey depending on a if function.

    Dear,

    I have the following:

    THIS WORKBOOK
    Please Login or Register  to view this content.

    SHEET "DATABASE"
    Please Login or Register  to view this content.
    SHEET "DATABASE"
    Please Login or Register  to view this content.
    it works good for the sheet "DataBase". But in the other sheets I want the delete key to have its normal function instead of popping up the message box. You now what to change?

    with kind regards,

    marc

  6. #6
    Registered User
    Join Date
    04-25-2012
    Location
    Curacao
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: application.onkey depending on a if function.

    Dear,

    I have the following:

    THIS WORKBOOK
    Please Login or Register  to view this content.

    SHEET "DATABASE"
    Please Login or Register  to view this content.
    SHEET "DATABASE"
    Please Login or Register  to view this content.
    it works good for the sheet "DataBase". But in the other sheets I want the delete key to have its normal function instead of popping up the message box. You now what to change?

    with kind regards,

    marc

  7. #7
    Registered User
    Join Date
    04-25-2012
    Location
    Curacao
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: application.onkey depending on a if function.

    Dear,

    Thanks a lot for helping me out.

    IT WORKS.

    I changed the following:

    THIS WORKBOOK
    Please Login or Register  to view this content.
    kind regards,

    marc

  8. #8
    Registered User
    Join Date
    04-25-2012
    Location
    Curacao
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: application.onkey depending on a if function.

    Dear,

    Thanks a lot for helping me out.

    IT WORKS.

    I changed the following:

    THIS WORKBOOK
    Please Login or Register  to view this content.
    kind regards,

    marc

+ 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