ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   RESTRICT TO PASTE VALUES ONLY (https://www.excelbanter.com/excel-discussion-misc-queries/195608-restrict-paste-values-only.html)

FARAZ QURESHI

RESTRICT TO PASTE VALUES ONLY
 
What would be the appropriate code to restrict the user from using pasting
format. In other words, whenever a user uses Ctrl+V only the values are
pasted.

Thanx in advance.

--

Best Regards,
FARAZ A. QURESHI

Wigi

RESTRICT TO PASTE VALUES ONLY
 
Use Application.OnKey to assign one of your macro's to the shortcut
combination Ctrl-V.

Remember to set it back afterwards, or even if the user deactivates the
workbook (since this can be annoying).

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"FARAZ QURESHI" wrote:

What would be the appropriate code to restrict the user from using pasting
format. In other words, whenever a user uses Ctrl+V only the values are
pasted.

Thanx in advance.

--

Best Regards,
FARAZ A. QURESHI


aggiemullins

RESTRICT TO PASTE VALUES ONLY
 
Is there one for copy/paste?

"Gord Dibben" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
'retain formatting when a cell is copied over
Dim myValue
With Application
.EnableEvents = False
myValue = Target.Value
.Undo
Target = myValue
.EnableEvents = True
.CutCopyMode = False
End With
End Sub

Note: works only with with copy/paste, not cut/paste


Gord Dibben MS Excel MVP


On Sun, 20 Jul 2008 23:38:00 -0700, FARAZ QURESHI
wrote:

What would be the appropriate code to restrict the user from using pasting
format. In other words, whenever a user uses Ctrl+V only the values are
pasted.

Thanx in advance.




Gord Dibben

RESTRICT TO PASTE VALUES ONLY
 
I think you mean cut/paste.

No. I don't have code for that.


Gord

On Sun, 7 Sep 2008 20:33:01 -0700, aggiemullins
wrote:

Is there one for copy/paste?

"Gord Dibben" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
'retain formatting when a cell is copied over
Dim myValue
With Application
.EnableEvents = False
myValue = Target.Value
.Undo
Target = myValue
.EnableEvents = True
.CutCopyMode = False
End With
End Sub

Note: works only with with copy/paste, not cut/paste


Gord Dibben MS Excel MVP


On Sun, 20 Jul 2008 23:38:00 -0700, FARAZ QURESHI
wrote:

What would be the appropriate code to restrict the user from using pasting
format. In other words, whenever a user uses Ctrl+V only the values are
pasted.

Thanx in advance.






All times are GMT +1. The time now is 08:24 PM.

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