Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Preventing Someone from Recreating a Protected Worksheet.

Preventing Someone from Recreating a Protected Worksheet

by Allen Wyatt
(last updated June 6, 2017)

5

Jack creates worksheets that he forwards to others in his group so they can input information, and then return the worksheet to him. He protects the worksheets, but has gotten burned a few times by users who have used copy and paste to recreate the worksheet in its entirety. Checking everything to make sure the returned worksheets are the originals is very time consuming, so Jack is looking for a way to remove the ability to copy and paste the worksheets.

Disabling copying and pasting is theoretically easy enough to do. All you need to do is use a short macro, like the following, in the ThisWorkbook object:

Private Sub Worksheet_Deactivate()
    If ActiveSheet.ProtectContents = True Then
        Application.CutCopyMode = False
    End If
End Sub

Using this macro essentially clears the Clipboard every time someone deactivates the worksheet by selecting another worksheet or another application.

Of course, this offers only the most rudimentary of protection. A determined user can still copy the worksheet by using Edit | Move or Copy Sheet, or they could disable macros when starting the workbook, and thereby disable your Clipboard-clearing routine.

Perhaps a better way is to look at how business is done in the organization. If you don't want people to copy the worksheet, tell them up front, and make sure they know that you won't accept any duplicates. There are very easy ways to check to see if what you get back is a duplicate. Here are a few of them:

  • Put a formula in a cell, then hide the cell contents during your protection process. If you get the worksheet back and unprotect the worksheet, and the formula is not there, the worksheet is a copy.
  • Protect the worksheet by using a password. If you cannot later unprotect the worksheet with the same password, you know that someone else copied the worksheet and used their own password.
  • Have your worksheet use hidden formulas to access data on a hidden worksheet. If the user copies the worksheet, the hidden worksheet isn't copied to the new workbook, so the formulas won't give the correct answers.
  • Insert a macro module in the workbook, and then protect the module. The module doesn't need to do anything, but if the workbook you get back doesn't have the protected module or is a simple XLSX file, it is a copy.
  • Add something into the custom properties area of the workbook. If the custom property is not in the workbook you get back, chances are good that the workbook is not the original.

Another thing to try is to set the cell protection property to Hidden before password protecting your worksheet. Users can see the results of what is in the cells, but they cannot see the formulas. If they copy and paste the contents elsewhere, the formulas won't be transferred, only the results. This is very easy to spot in the returned workbook.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12653) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Preventing Someone from Recreating a Protected Worksheet.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Checking All Cell Formatting in VBA

When your macro checks the formatting used for a cell, it needs to be careful that the type of formatting being checked is ...

Discover More

Understanding Justification

Paragraphs can be aligned in four different ways. This tip examines those alignment methods.

Discover More

Where Is that Name?

Want to easily see the location of named ranges in your worksheet? It's easy; all you need to do is use the familiar Zoom ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Enabling Editing Erases Worksheet

If you receive a protected worksheet that you want to edit, how do you proceed if you try to unprotect the worksheet and ...

Discover More

Locking a Worksheet Automatically

The protection features built into Excel can help you to make sure that only things are changeable that you want changed. ...

Discover More

Forcing a Worksheet to be Protected Again

Excel allows you to protect your worksheets so they can only be changed as you want to have happen. If you unprotect a ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two less than 2?

2017-06-30 01:50:26

Nitesh Halai

In response to Alec Whatmough's "Now, unless the user has password-cracking abilities", the user would only need googling ability. There are many sites (including this one, if I remember correctly) that shows ways to unlock a password protected worksheet.


2017-06-07 02:26:08

gerdami

@Henk,
I am saying that when I hide something, I tell my users / colleagues that I did it. Openness! Glasnost!


2017-06-06 03:59:19

Henk

If you find hidden features irritating, you are obviously trying to do something you are not supposed to.


2017-06-06 02:26:15

gerdami

Hidden features in a workbook are irritating.
If you hide something then tell your users why you did it.


2013-05-26 16:20:59

Alec Whatmough

Another option is to stop users getting around the code mentioned above is to insert a sheet with text stating that the workbook must be opened with Macros enabled. Hide sheet tabs (or hide the sheets that a user needs) and add passworded workbook protection. Now add Workbook_Open code to select a different sheet (the one you want users to access)as well as anything else you want (e.g. show sheet tabs).
Now, unless the user has password-cracking abilities, opening the workbook with macros disabled won't help them at all.
The fianl step is a Before_Close routine to select the notice sheet and hide the others


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.