Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If pressed no to msgbox, then exit sub Hari[_3_] Excel Programming 5 January 17th 05 02:52 PM
Delete is Pressed then Stop Lenny_821 Excel Programming 1 October 11th 04 12:56 PM
Which button was pressed? Adrian[_4_] Excel Programming 7 April 28th 04 04:55 PM
Trapping key pressed in a worksheet John[_35_] Excel Programming 1 February 28th 04 05:46 AM
ComboBox DropDown when Key is pressed shrekut[_9_] Excel Programming 2 February 2nd 04 11:30 PM


All times are GMT +1. The time now is 02:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"