I created an excel file about costing a metal desking frame, it consist of several worksheets, there is one specific worksheet - a template - where the user can enter data - but this sheet must not be duplicated as it would mess up the program, I protected the sheet but when pressing Ctrl key at the same time mouse dragging the sheet to the right it duplicated the sheet! while protect workbook completely freezes all worksheets! I want to prevent copy (duplication) only on one sheet (the template). How can I do this
also How do I prevent this specific sheet from being accidentally (or intentionally) deleted?
What you need to do is lock/unlock cells as required, and then enable worksheet protection. Passwords are optional but recommended to prevent accidental unlocking.
An important thing to note before going any further is that there is no fail-safe way to protect an Office document (against neither accidental nor intentional abuse or distribution). Even Office document passwords are easily defeated.
If you are this concerned about this data, you need to make sure that you are backing it up regularly, and automatically, and keep several versions of backups... (not just the most recent!)
Protecting a worksheet from changes
When you protect a worksheet, all cells are locked by default, which means that they cannot be edited. To enable cells to be edited while leaving only some cells locked, you can unlock all the cells and then lock only specific cells and ranges before you protect the worksheet. You can also enable specific users to edit specific ranges in a protected worksheet.
Try this an an example of the most basic form of protection:
Make a backup copy of your workbook before proceeding.
Click the Review tab, and then click Protect Sheet.
For now, just ignore the check boxes at the bottom of the Protect Sheet window. Choose a password and enter it where prompted. (Do not use a password that you use for other things.)
Click OK. Enter the password a second time and click OK again. The worksheet is now protected.
At this point, experiment to see if you are able to make the changes you were concerned about, such and duplicating cells with "Ctrl+Drag".
This is the default setting for protection. You'll notice that you can't use any of the cells at all, even for "legitimate" purposes, however this can be easily rectified too (with the password!).
Removing workbook protection
When you want to re-enable changes to the worksheet:
Click Unprotect Sheet on the Review tab.
Enter the password you previously set.
...I literally already forgot the password I had set, so the unlocking request was denied:
It's okay, I made a backup first and had it stored in a safe location.
(Actually, it was a test workbook, and even if it wasn't, I could bypass password protection on any Office document in under 5 minutes. Hence the earlier warning...)
Protecting only certain areas or certain activities
In most cases, it's not feasible to have the sheet 100% protected at all times, effectively rendering it "read-only" and non-interactive. (If it were necessary, you're better off to print the worksheet and hand out ultra-safe paper copies.)
Protection can be customized in numerous ways, the most common being unlocking only the sections that the user needs to be able to change.
In the example below, I protect the whole worksheet (since cells are set to "Locked" by default) with the exception of the 2 cells that require data entry.
Personally I like to always shade the unlocked cells a different color, so that it's obvious to the users which cells they can/can't use.
There are too many options to go into them all here, but below are links some of the many sites with more information and examples about Excel workbook ad worksheet security, protection, and other safety concerns:
Office.com : Protection and security in Excel
Office.com : Protect a worksheet (Excel)
Office.com : Lock or unlock specific areas of a protected worksheet
Newco.co : Excel 365: How to Protect Cells in a Shared Worksheet
MSDN : Password protect workbooks and worksheets (Video)
Related
I have a shift planner and it can be seen/used by anyone in order to mark down their shifts. I now have created a new Worksheet that calculates how many vacation days each employee has left in order to have a better overview. Since it is law that it should not be viewed by other employees,
I thought of giving that sheet a Password. When I set the Password however, anyone can still see the contents of the sheet.
How can I set it up, so that the sheet cannot be viewed as long as the Password is not correct?
You can make that sheet "very hidden".
Steps to do:
save document as xlsm (with macros)
open the vba-editor (ALT + F11)
set the sheet to very hidden - "very hidden" means that it is not possible to unhide the sheet via the Excel-GUI (like a hidden sheet) - but only via the VBE-GUI.
To prevent users from unhiding via the VBA-Editor:
Select Extras - VBA Project properties (Eigenschaften von VBA-Projekt)
Go to the protection tab and choose to lock project plus add password.
(This protection only works if the file is stored as xlsm.)
Please be aware that there are lots of sources that explain how to crack the VBE-password. If someone wants to see the sheet he or she will be able to. An Excel-file will never be 100 % safe.
I'm currently trying to construct a Workbook consisting of several Worksheets. However, the worksheets should be protected in a way so that they can't be opened unless the correct password is given. Ideally each worksheet should have its own password, i.e. if I were to click on say 'Sheet 2' I would have to enter a password in order to actually see the content of that sheet. I'm quite new to VBA and don't even know if this is even possible.
I have tried to solve the problem without VBA, but Excel does not have that kind of feature and only allows for the protection of cells, etc.
I have created an add-in that sends and retrieves data from a database in order for this data to be used by our analysts.
To prevent changes made to existing data points I want to lock the cells containing this data. Initially, I did this by locking the range of the data and protecting the workbook, since otherwise the locking does not work. However, protecting the workbook also removes/limits a lot of functionality for the end-user, such as creating graphs, the auto fill function, changing the format etc. Since these and other functionalities are needed for the end-user, I cannot protect the workbook. Still, I want to lock the cell containing the data points.
So my question is, is it possible to lock the cells in a dynamic range (I have macros detecting the correct end column and end row of the data points) without protecting the workbook? If so, how? If not, would it be possible to detect changes in the dynamic range and show a messagebox that changes are not allowed in this specific cell/range and revert back to the old value of the cell? If so, how?
I have seen a few posts asking a similar question, but these were either not answered or the answer was not satisfying for my case (e.g. a macro implemented in the VBA project of the workbook instead of the VBA project of the add-in).
Thanks in advance for your answer(s)!
Kind regards,
Robbert
Use
ActiveSheet.Cells.Locked=False
Then Lock your range which you don't want to be edited using:
Range("A1:A4").Cells.Locked=True
Then protect the sheet
ActiveSheet.Protect Contents:=True, DrawingObjects:=False
This will only protect the contents that are Locked and still allow you to change values in the rest of the sheet and insert/delete charts. You may have to change extra settings with Protect. More details can be found here
You don't have to protect the Workbook, only the Worksheet.
To protect/unprotect a sheet via VBA, use Worksheet-methods protect resp. unprotect (you can apply a password).
To prevent a range to be modified, you have to set it's locked-property to True and protect the sheet (all cells have the propery locked set by default).
Be aware that, if a Range is locked and the worksheet is protected, you cannot modifiy the Range via VBA. If you want to do so, use the unprotect method at the top of the code (but don't forget to protect the sheet again when you're done). As an alternative, you can call protect with parameter UserInterfaceOnly:=True, but unfortunately Excel doesn't save this property. So if you save an Excel file where a worksheet is protected with UserInterfaceOnly:=True and reopen it, the sheet is protected also for VBA.
I received a protected excel file which only allows me to add values or select from a drop down list. The file has lots of different tabs, all in different format and questions.
I then unprotected the workbook to make my life easier (i.e. copy, paste, make notes etc)
using the code found here:
http://uknowit.uwgb.edu/page.php?id=28850
Now i am looking for a way to transfer all the values from the unprotected file back to the original file they sent me as I cannot submit an unprotected file. It is too many questions to do manually.
What is the best way to do this in excel 2013/VBA?
Thank you
It looks like you're wanting to do this on a sheet that previously had a password you didn't have access to. Also, it seems that you can't ask the worksheet creator to simply remove the password.
If both these are true, the best solution would be to save the modified sheet with the same name and send that sheet. From what I've seen, VBA and developer tools don't include a way to copy values to locked regions in a password-protected sheet, without unlocking that sheet:
ActiveSheet.Unprotect 'method to unlock current sheet, password may be required
ActiveSheet.Protect 'same to lock again
But, once a sheet is unlocked, you could loop through all cells in the region you want to copy from, and copy those values to the new sheet / workbook.
Please let us know if there's something else, or if something needs to be explained in more detail.
I have employees that use a macro/external data enabled Excel file. One of the worksheets in this file contains proprietary data, that is populated from an external data source ODBC connection. This proprietary worksheet is always hidden from the user, because it just serves as a Vlookup-function data-source
I want to prevent my employees from accidentally emailing this Excel file, because I don’t want the hidden worksheet data to be available to non-employees
Please advise if there is anything I can do prevent the email recipient from being able to view the data that is in the hidden worksheet, if the app is accidentally emailed to them.
Are any of the following ideas feasible?:
Password protecting the hidden worksheet, yet, not preventing the Vlookup function from the other worksheet from functioning?
Imbedding something into the app that resembles a virus, to cause all email servers to block the attachment.
Creating a macro that deletes the data from the hidden worksheet when the app is closed
Imbedding large images into the app to make it too large to email, but yet won’t affect the performance.
Please advise, thank you very much in advance, Nathaniel
In regards to number 3, there is a setting like this in the Connection Properties. It's "Remove Data from the external data range before saving the workbook." I'm not looking at XL 2003, but it's nested under the "Refresh Data When Opening the File" option. As others have said, this isn't foolproof, but it might help meet your requirements.
I don't think you can fundamentally prevent your workbook to be sent around. Password-protecting the sheet would be of little help, as it is fairly easy to bypass. The safest approach to protect your proprietary data from prying eyes would be to not have it in the worksheet itself, retrieve it dynamically by prompting the user for some credentials, and never save it in a worksheet.
You can hide the sheet from the developer tab of excel. To do this, follow the steps below
Open the excel
Press Alt + F11
Here you can see the list of sheets on your excel file
Select the sheet that you want to hide
When you select the sheet you can see the properties of the particular sheet below
Set the visibility property to ‘2 – xlSheetVeryHidden’
Now right click on the sheet and select VBAProject – Project Properties
Navigate to the Protection tab and check ‘Lock project for viewing’
Set a password
Sheets hidden in this way cannot be un hidden unless one has access to the VBA Project (but this is now password protected). The sheet can be seen only if you know the password.