Stopping Users Cutting & Pasting

Jon B

New Member
Joined
Jan 5, 2003
Messages
36
Hi, Quick bit of help needed if possible:

I've got a workbook that is mostly protected, but some cells need to be left unlocked for users to type in. My question is how I stop users cutting & pasting from these cells and messing up the formulas?

I've used a Worksheet_BeforeRightClick macro, but they can still use the icons or menus.

Any Ideas? (I get the horrible feeling I'm missing something really obvious)

Thanks
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi,

You can get somewhere in achieving this by trying the following:-

Place these procedures in the workbook code module of your workbook (see the Workbook Modules section from here to see how to do that) :-

<pre>Private <FONT COLOR="#00007F">Sub</FONT> Workbook_Deactivate()
Application.CutCopyMode = <FONT COLOR="#00007F">False</FONT>
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">Sub</FONT>


<FONT COLOR="#00007F">Private</FONT> <FONT COLOR="#00007F">Sub</FONT> Workbook_SheetChange(<FONT COLOR="#00007F">ByVal</FONT> Sh <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>, <FONT COLOR="#00007F">ByVal</FONT> Target <FONT COLOR="#00007F">As</FONT> Range)
Application.CutCopyMode = <FONT COLOR="#00007F">False</FONT>
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">Sub</FONT>


<FONT COLOR="#00007F">Private</FONT> <FONT COLOR="#00007F">Sub</FONT> Workbook_SheetDeactivate(<FONT COLOR="#00007F">ByVal</FONT> Sh <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>)
Application.CutCopyMode = <FONT COLOR="#00007F">False</FONT>
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">Sub</FONT>


<FONT COLOR="#00007F">Private</FONT> <FONT COLOR="#00007F">Sub</FONT> Workbook_WindowDeactivate(<FONT COLOR="#00007F">ByVal</FONT> Wn <FONT COLOR="#00007F">As</FONT> Window)
Application.CutCopyMode = <FONT COLOR="#00007F">False</FONT>
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">Sub</FONT>
</pre>

This should effectively disable most ways of copying/cutting and pasting (it's by no means foolproof though). You may want to only use if you want to allow certain copying e.g. remove the Workbook_Deactivate procedure if you want to allow your users to copy from your workbook to another.
 
Upvote 0

Forum statistics

Threads
1,216,073
Messages
6,128,644
Members
449,461
Latest member
kokoanutt

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