MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Prevent Cell Selection/Copy


Posted by TSmith on April 16, 2001 4:10 AM

I'm setting up a protected workbook and I'm trying to prevent Users from copying cell contents from the protected workbook and pasteing them into a new workbook. Help?


Posted by Dave Hawley on April 16, 2001 4:16 AM

Hi TSmith

You can use some simple VBA for this placed within the Module of ThisWorkbook.

Right click on the sheet picture, top left next to "File" and paste in this code:

'Prevent copying of Workbook content
'Written by OzGrid Business Applications
'www.ozgrid.com

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Application.CutCopyMode = False
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Application.CutCopyMode = False
End Sub

Push Alt+Q and Save.
Now apply Sheet and Workbook protection.


Dave


OzGrid Business Applications