Substitute copy for cut

K

KS

I have some users that cannot figure out difference between copy and
cut. They are always cutting when they should be copying. How can I
write a code that anytime, anyway they choose cut it will automatically
change it to a copy? They are basically selection some cells in a
worksheet & cutting them somewhere else in the worksheet. What they are
doing is simple but how can I override their keystrokes to be the
correct one?

Thanks for any help.

KS
 
C

Charles Chickering

You really should educate your users rather than screwing with their pcs. You
can place a macro in your workbook and use Ctl + x as the shortcut to it,
with this line of code for the macro to run:
Selection.Copy
that will prevent the keyboard shortcut.
 
N

NickHK

Whilst agreeing with Charles that your users should be able to handle a copy
or cut correctly, see if this untested code helps. Based on code from the
Help example for "CutCopyMode Property".

Const RangeNoCut As String = "A1:M500"
Dim PreviousRange As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not PreviousRange Is Nothing Then
If Not Intersect(PreviousRange, Range(RangeNoCut)) Is Nothing Then
Select Case Application.CutCopyMode
Case Is = False
'Normal, allow
'MsgBox "Not in Cut or Copy mode"
Case Is = xlCopy
'Copy, allow
'MsgBox "In Copy mode"
Case Is = xlCut
'Cut, change to copy
'MsgBox "In Cut mode"
'Cancel the Cut
Application.CutCopyMode = False
'Now copy the previous range
PreviousRange.Copy
End Select
End If
End If

Set PreviousRange = Target

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top