+ Reply to Thread
Results 1 to 2 of 2

Was Delete Key pressed?

  1. #1
    HLong
    Guest

    Was Delete Key pressed?

    The user selects a cell and presses the delete key. Now, would it be possible
    to determine if the user pressed the delete key on the SheetChange event
    handler? I tried the GetKeyState function. It works fine the first time,
    but after the function always returns positive, the key has been pressed. My
    intension is to determine if the user is deleting the content on a cell. If
    it is true, then the routine deletes the contents of other cells on the
    sheet.

  2. #2
    Jim Thomlinson
    Guest

    RE: Was Delete Key pressed?

    Why not just check the contents of the cell at the change event. If the cell
    is blank then...

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Trim(Target.Value) = Empty Then
    MsgBox "Empty Cell"
    End If
    End Sub

    This catches both delete and backspace.
    --
    HTH...

    Jim Thomlinson


    "HLong" wrote:

    > The user selects a cell and presses the delete key. Now, would it be possible
    > to determine if the user pressed the delete key on the SheetChange event
    > handler? I tried the GetKeyState function. It works fine the first time,
    > but after the function always returns positive, the key has been pressed. My
    > intension is to determine if the user is deleting the content on a cell. If
    > it is true, then the routine deletes the contents of other cells on the
    > sheet.


+ 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