Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Key event
How can I get a key press [down | up] event in Excel? Or,
how do I know if the delete key was pressed? Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Key event
Hi Greg,
Not available in Excel, why do you want it, what do you want to check. There may be some alternatives are available. There are some API material on Stephen Bullen's site http://www.bmsltd.ie/Excel/Default.htm --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "Greg" wrotel... How can I get a key press [down | up] event in Excel? Or, how do I know if the delete key was pressed? Thanks! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Key event
Hi Greg,
Not available in Excel, why do you want it, what do you want to check. There may be some alternatives are available. There are some API material on Stephen Bullen's site http://www.bmsltd.ie/Excel/Default.htm --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "Greg" wrotel... How can I get a key press [down | up] event in Excel? Or, how do I know if the delete key was pressed? Thanks! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Key event
Greg,
There is really no good way to do this. Perhaps if you describe why you need to trap the Delete key, some one could come up with a suitable workaround (e.g., the Change event procedure). -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Greg" wrote in message ... How can I get a key press [down | up] event in Excel? Or, how do I know if the delete key was pressed? Thanks! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Key event
I want to let the user delete selected text/content in
selected cells. However, I want the user to be unable to delete rows at a time... I hope that makes sense... I don't want the user to be able to select a row(s) and hit delete... Thanks! -----Original Message----- Greg, There is really no good way to do this. Perhaps if you describe why you need to trap the Delete key, some one could come up with a suitable workaround (e.g., the Change event procedure). -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Greg" wrote in message ... How can I get a key press [down | up] event in Excel? Or, how do I know if the delete key was pressed? Thanks! . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Key event
Greg,
Have you taken a look at using the sheet protection command from the Menubar. I'm not sure what version of Excel you have. The newer versions allow a more granular control of protection including deletion of rows and columns. Alternatively, below is some code that uses Application.OnKey to trap the Delete key. Test and see if it does what you want. You will need to call the Initialize_DeleteTrap routine in a Workbook_Open event or something similar. Troy Sub Initialize_DeleteTrap() Application.OnKey "{DEL}", "subDeletePressed" End Sub Sub subDeletePressed() Dim rng As Range If TypeName(Selection) = "Range" Then Set rng = Selection If rng.Address = rng.EntireRow.Address Then MsgBox "Not allowed to delete entire row" ElseIf rng.Address = rng.EntireColumn.Address Then MsgBox "Not allowed to delete entire column" Else Application.OnKey "{DEL}" SendKeys "{DEL}", True Application.OnKey "{DEL}", "subDeletePressed" End If Else Application.OnKey "{DEL}" SendKeys "{DEL}", True Application.OnKey "{DEL}", "subDeletePressed" End If Set rng = Nothing End Sub "Greg" wrote in message ... I want to let the user delete selected text/content in selected cells. However, I want the user to be unable to delete rows at a time... I hope that makes sense... I don't want the user to be able to select a row(s) and hit delete... Thanks! -----Original Message----- Greg, There is really no good way to do this. Perhaps if you describe why you need to trap the Delete key, some one could come up with a suitable workaround (e.g., the Change event procedure). -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Greg" wrote in message ... How can I get a key press [down | up] event in Excel? Or, how do I know if the delete key was pressed? Thanks! . |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Key event
Why not unlock the cells you will allow the user to alter, then protect the
worksheet. -- Regards, Tom Ogilvy "Greg" wrote in message ... I want to let the user delete selected text/content in selected cells. However, I want the user to be unable to delete rows at a time... I hope that makes sense... I don't want the user to be able to select a row(s) and hit delete... Thanks! -----Original Message----- Greg, There is really no good way to do this. Perhaps if you describe why you need to trap the Delete key, some one could come up with a suitable workaround (e.g., the Change event procedure). -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Greg" wrote in message ... How can I get a key press [down | up] event in Excel? Or, how do I know if the delete key was pressed? Thanks! . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Event Procedures: Event on Worksheet to fire Event on another Worksheet | Excel Programming | |||
vba event | Excel Programming | |||
Do Event | Excel Programming | |||
change event/after update event?? | Excel Programming | |||
OnTime event not firing in Workbook_Open event procedure | Excel Programming |