LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default delete row base the value of certain column

Hi How are you?
My customer report this to me, he delete some row by mistake using hot key
Ctrl-D. he want me to put code to prevent it happening. What I shold do it,
check a certain column (e.g. column ZZ), if there are value, DO NOT delete
this row. cancel the deletion. if it is empty, it is fine to delete.
after some research, here is my plan,
1. assign Ctrl-D to my DoNothing routine,
2. in Worksheet_SelectionChange function, I will check if a value in
column ZZ, yes, I am not change hot key assignment by
Application.OnKey "^{d}", ""
no, I will assign Ctrl-D back to Delete row by
Application.OnKey "^{d}", "InsertProc"
Now my problem is, I do not how to do that. which command string should I
use in the place of "InsertProc". Your help will be deeply appreciated.
aboud my solution, if you have any idea, suggestion, advice, anything, I
would love to hear.



Thank you and have nice day.
Wes






code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target(1, 1).Value < "" Then
Application.OnKey "^{d}", ""
MsgBox "disable"
Else
Application.OnKey "^{d}", "InsertProc" ' <- here is my question
MsgBox "enable"
End If
End Sub

Public Sub Donothing()
MsgBox "Here is my DoNothing"
End Sub
 
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
Copy column header to next column, delete & delete every nth colum genehunter New Users to Excel 1 June 2nd 09 03:57 PM
Merging rows base on value in other column Real Excel Discussion (Misc queries) 2 February 17th 08 07:52 PM
Sort Data Base By Column travelersway New Users to Excel 4 August 21st 06 11:22 PM
select a range base on Column A JUAN Excel Programming 3 July 27th 04 07:49 PM
Row to column data move base on row Andrew[_11_] Excel Programming 8 August 7th 03 08:11 AM


All times are GMT +1. The time now is 01:45 PM.

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

About Us

"It's about Microsoft Excel"