Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Copy and paste in Excel 1

Status
Not open for further replies.

Matt27

MIS
Jun 2, 2004
59
GB
Does anyone have any idea how I allow users to enter information into a cell in Excel but at the same time preventing them from copying or pasting within the worksheet?
 
Hi,
I've gone into the Excel file, right clicked on the Excel symbol in the top left of the screen, selected 'View Code' and put your peice of code in here. I've saved the file, closed it and re-opened it but I'm still able to copy and paste. Am I doing something wrong?

Thanks.
 
Hi Matt,

OK, I've just had a quick look at the code. It doesn't run automatically so you need to call the disable routine when your workbook opens and the enable one when it closes. I'll have to knock up a test later to see exactly what it does but I believe it does the job as well as it can be done.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Hi Tony,
Thanks for that - my apologies, the code does work - I just needed to change it so that it ran when the file opened and enabled the commands again when it closed as you say!!

Thanks for your help.

Matt
 
Glad you're sorted!

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Though the first thing many people will do is disable macros when the warning prompt appears as they open the file, which in turns means they can copy or paste as they will.

If you want to stop that, you will need to do something like hiding all the sheets in the book bar one, which perhaps has a warninmg message on it telling them that they have to enable macros to work on the file. Then in the open event, you hide that warning sheet and display all the normal sheets, reversing it on close.

That way if they open the file and disable macros, they don't get to play.

Regards
Ken.............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 

As is often pointed out ... if someone can read a file, they can copy it and there is nothing you can do to stop them - all you can do is slow them down a little.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top