Hi TommyGun and Blk,
The code posted is great however it only works for copying but NOT moving data.
So if the User makes a Cut /Paste, the data is pasted together with all the Formatting !
To achieve the same result with Cut & Paste, place the first code below in the WorkSheet Module and the Second one in a Standard Module :
1st Part Of Code:
Private Sub Worksheet_Activate()
Customise_CutCopyPaste
End Sub
Private Sub Worksheet_Deactivate()
Restore_CutCopyPaste
End Sub
Public Sub Customise_CutCopyPaste()
With Application
.OnKey "^x", "CutSource"
.OnKey "^v", "PasteTarget"
End With
With CommandBars("Edit")
.Controls("Paste").OnAction = "PasteTarget"
.Controls("Paste Special...").OnAction = "PasteTarget"
.Controls("Cut").OnAction = "CutSource"
End With
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Customise_CutCopyPaste
End Sub
Public Sub Restore_CutCopyPaste()
With Application
.OnKey "^x"
.OnKey "^v"
End With
With CommandBars("Edit")
.Controls("Paste").OnAction = ""
.Controls("Paste Special...").OnAction = ""
.Controls("Cut").OnAction = ""
End With
End Sub
2nd Part Of Code :
Public CutMode As Boolean
Public SourceRange As Range
Public Sub CutSource()
CutMode = True
ActiveCell.Copy
Set SourceRange = ActiveCell
End Sub
Public Sub PasteTarget()
If Application.CutCopyMode = xlCopy And CutMode = True Then
ActiveCell.PasteSpecial xlPasteValues
SourceRange.Clear
CutMode = False
Else
ActiveCell.PasteSpecial xlPasteValues
End If
End Sub
I must admit the codes seem a bit sloppy to me. I hope someone has a simpler solution !
Regards.