ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Substitute copy for cut (https://www.excelbanter.com/excel-programming/376310-substitute-copy-cut.html)

KS[_2_]

Substitute copy for cut
 
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


Charles Chickering

Substitute copy for cut
 
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.
--
Charles Chickering

"A good example is twice the value of good advice."


"KS" wrote:

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



NickHK

Substitute copy for cut
 
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


"KS" wrote in message
ups.com...
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





All times are GMT +1. The time now is 02:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com