Another approach could be...
In a regular module add code like this...
'----------------------
Sub InformUser()
Dim FirstAssumption
Dim SecondAssumption
'code here determines variable values
If FirstAssumption = SecondAssumption Then
MsgBox "Please do not make changes to the worksheet. " & vbCr & _
"Contact your supervisor if you have questions. ", _
vbCritical, " Don't do that"
Application.Undo
End If
End Sub
'----------------------
In the code module for the sheet add code like this...
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
'Call sub
InformUser
Application.EnableEvents = True
End Sub
'--------------------
Jim Cone
San Francisco, USA
"Jim Cone" wrote in message
...
Take a look at the "Interactive" property of the
Application object. It blocks most use of the keyboard.
Also the following code could be experimented with...
'---------------------------------------------------------------
Laurent Longre ) 10/12/2000
public.excel.programming
Disabling All Key Combinations
Dim K
Dim Key
Dim Key2
Dim I As Integer
On Error Resume Next
K = Array("{BS}", "{BREAK}", "{CAPSLOCK}", "{CLEAR}", "{DEL}", _
"{DOWN}", "{END}", "{ENTER}", "~", "{ESC}", "{HELP}", "{HOME}", _
"{INSERT}", "{LEFT}", "{NUMLOCK}", "{PGDN}", "{PGUP}", _
"{RETURN}", "{RIGHT}", "{SCROLLLOCK}", "{TAB}", "{UP}")
For Each Key In Array("", "+", "^", "%", "+^", "+%", "^%", "+^%")
For Each Key2 In K
Application.OnKey Key & Key2, ""
Next Key2
For I = 1 To 15
Application.OnKey Key & "{F" & I & "}", ""
Next I
For I = 0 To 255
Application.OnKey Key & Chr$(I), ""
Next I
Next Key
-------------------------------
'(To enable "Normal" keys) jbc
-------------------------------
Dim Key, I As Integer
On Error Resume Next
For Each Key In Array("^", "%", "+^", "+%", "^%", "+^%")
For I = 32 To 255
Application.OnKey Key & Chr$(I)', ""
Next I
Next Key
'------------------------------------
I've never done much with this concept as I feel
it could turn very ugly on you.
User training is an alternative.
Jim Cone
San Francisco, USA
wrote in message
oups.com...
I'm ok to use either of these. Could you please suggest some example ?
|