paste special, values only

WGRoad

New Member
Joined
Apr 9, 2011
Messages
13
Hello all,

I was looking for a way to prevent other users of some workbooks I created, from copying and pasting my linestyles, formats, etc, wanting them, when they pasted, to allow them to only paste the values and formulas inside a specific range of cells.
So, I have found the next code that is already a good problem solver, preventing actually people from doing any copy or cut on the book, and while nearly never they copy outside information onto the book, trough some tests I found that if they want they can copy from an outside this book source, and paste it, most times pasting, and blocking that cell from being used, as most of my workbook is protected apart from that specific range of cells.

Code:
Private Sub Workbook_Activate()
Application.CutCopyMode = True
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
End Sub
Private Sub Workbook_Deactivate()
Application.CellDragAndDrop = True
Application.OnKey "^c"
Application.CutCopyMode = False
End Sub
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
Application.CutCopyMode = False
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
End Sub
Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Application.CellDragAndDrop = True
Application.OnKey "^c"
Application.CutCopyMode = False
End Sub
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Cancel = True
MsgBox "Right click menu deactivated." & vbCrLf & _
"Cannot copy or ''drag & drop''... MUHAHAHAHAHA!!!", 16, "For this workbook:"
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Application.CutCopyMode = False
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
Application.CutCopyMode = False
End Sub
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Application.CutCopyMode = False
End Sub

So, I am trying to find a modification to this bit of code, so that I allow people to copy, and paste only values and formulas. I would like to keep the right click option deactivated though, as it is a big help people not being able to access that quick menu.
Any thoughts on this?

The range of cells I want to be able to accept this solution are C9:Q20, C23:Q24, C27:Q50, and C53:Q78. Rest of the cells in the worksheets are protected. If it helps, the workbook as 10 worksheets.

Thanks in advance for the attention to the matter.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,224,525
Messages
6,179,319
Members
452,905
Latest member
deadwings

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