Dear,
I have the following:
THIS WORKBOOK
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If ActiveSheet.ProtectContents = True Then
Application.OnKey "{DELETE}", "Sheet3.key"
Else
Application.OnKey "{DELETE}", "Sheet3.key2"
End If
End Sub
SHEET "DATABASE"
Sub key()
If ActiveSheet.Name = "DataBase" And MsgBox("Are you sure you want to unlock the sheet?", vbYesNo) = vbYes Then
ActiveSheet.Unprotect ("cdmsum1")
Selection.ClearContents
End If
End Sub
SHEET "DATABASE"
Sub key2()
Selection.ClearContents
End Sub
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
Bookmarks