Restricting Paste in Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I restrict the "Paste" functionality in Excel to prevent the user
from pasting cell formats when copying and pasting? (i.e. only allowing
pasting values and/or formulas)

I am using Excel 2003
 
This may give you a start. However, I can't seea way to differentiate a
..Paste from a .PasteSpecial, so you may have .Undo, then .PasteSpecial of
what you wish to allow.
Check the address of Target to see if you wish to control that range.

Dim Cutting As Boolean

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Msg As String

With Application
Select Case .CutCopyMode
Case False
If Cutting Then
Msg = "Was Cut"
Else
Msg = "Normal Entry"
End If
Case xlCopy
Msg = "Pasted Copy"
'To disable .Paste
.EnableEvents = False
.Undo
.EnableEvents = True
End Select
End With
MsgBox Msg

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cutting = (Application.CutCopyMode = xlCut)
End Sub

NickHK
 
Hi FSC,

I've tried this :
Sub diab()
Application.OnKey "^{v}", ""
Application.CommandBars.FindControl(ID:=22).Enabled = False
End Sub


Rgds,

Halim

FCS menuliskan:
 

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

Back
Top