Pasting Only values - VBA Code Issue

DaRTH KiRo

New Member
Joined
Jan 24, 2018
Messages
39
Office Version
  1. 2016
Platform
  1. Windows
I am using the VBA code below to only allow values, no formatting, to be pasted in my spreadsheet. However, once I copy data it pastes it anywhere I click and won't stop. This may cause problems for us if someone who does not know about it pastes data and clicks off into another cell. Can someone please assist me with changing the code so that it will only do it once, or always someone to ctrl+v and paste only values?

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
Target.PasteSpecial xlPasteValues
Application.CutCopyMode = True
End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try
Code:
Application.CutCopyMode = False
 
Upvote 0
It does not appear that that changed anything. I realized something else though, after pasting from another excel sheet the cells that were copied are no longer copied. So the only real issue is if I have something copied from a source outside of excel. If I copy something from an email it will paste it where I click in excel forever, even after closing and re-opening, it also does not let me undo.
 
Upvote 0
What are you trying to do?
 
Upvote 0
I am trying to only allow values to be pasted in excel. We are pulling data from other sheets that have different formatting into one sheet that needs to have specific formatting. I do not want the other sheets formatting to be pulled.
 
Upvote 0
How about
Code:
Sub PasteValuesOnly()
Selection.PasteSpecial xlPasteValues
End Sub
& then you can assign Ctrl V as a keyboard shortcut
 
Upvote 0
Solution
Would the shortcut need to be added to everyone's computer, or is it saved within the specific excel file?
 
Upvote 0
It would need to be set on each computer
 
Upvote 0

Forum statistics

Threads
1,215,475
Messages
6,125,028
Members
449,205
Latest member
Eggy66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top