I have a workbook I have created with lots of different formula's. My question is, how can I stop the end user from stealing the formula's? I have had a look at: Protecting Code in an Excel Workbook?
This is generally for VBA. Is there a way to stop users doing this, or is it just worksheet protect and cross your fingers?
You probably should be more specific on what formulas are you trying to protect: Excel Worksheet formulas of the VBA code?
In general, you can create a custom VBA Add-in (i.e. .xla file) and protect it with password as per Excel documentation. In case your major concerns relate to worksheet function, then you can include them in said VBA add-in using for example, Range.Formula (re: https://msdn.microsoft.com/en-us/vba/excel-vba/articles/range-formula-property-excel ) or Range.FormulaArray properties.
Hope this may help.
There is no way to fully protect formulas in Excel. For every password protection type, there is a way to break that protection. The only thing you could do if you really wanted to prevent end-users from getting the formulas is to hard-code the entire sheet before sending it to them. Of course, if the workbook relies on user input and using formulas to output an answer, that won't work.
Do you need the formulas protected for some sort of IP reason, or just to prevent people from messing them up?
Related
I made some very complex Lambda formulas which I use frequently to validate UPC Check digits, and convert UPCs from UPC-E to UPC-A format
I tried to set them up as named ranges, then save the workbook as an Add-In, and followed all the steps I could find to add that add-in into my Excel, however it doesn't look like it keeps the named ranges at all (which is where Lambda formulas are stored)
Is there any way to get around this and still save these Lambda formulas as an Add-in?
I really don't want to have to re-create the entire complex formula in a module, but it seems I may have to do that in order to have the formulas available in every workbook I open
Alternatively, if there's any way within a VBA function for me to use my existing Lambda formula, I would love that, but I'm not sure if that is possible as I know that VBA is a quite different language than Excel's formulas.
I considered making a macro which instead would just add those named ranges to my workbook, but hoping for an easier solution.
Please let me know if you have any tips for this!
What about maintaining a Template,that’s what I do, means they are there in your new books and a quick way to access them for manual copying across to existing workbooks.
2nd idea is use autocorrect to store them with a shortcut word. Autocorrect is application level and there is VBA you can find to copy your AC shortcuts to a backup workbook and reimport them if your PC crashes.
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 could not find an answer to this, neither on Stack or on the wild web. I have a sheet where I need users to be able to use Text to Columns, however, I also need to protect the sheet. Everything works fine if Excel automatically does this (from Text to Column "short-term memory"), but I cannot access the option when protection is enabled.
It is not that any text is spilling onto locked cells, it's just that the option is greyed out after protecting the sheet. I would appreciate a non-VBA answer as I do not want to use macros on a shared file (the server is extremely slow and even normal excels take ages to save). However, if absolutely necessary, can you ninjas please tell me how I can set it up so that this problem is solved with the least possible performance hit?
P.S.: I am pretty new to VBA (practically uninitiated, I prefer R for everything). Also, the shared server is basically a network folder, so it is not likely that it will cause any issues other than being super-sloth.
If you protect a sheet, then only unlocked cells can be edited, that is, users can change the cell manually.
That is the core and purpose of sheet protection.
In a protected sheet you will not be able to perform a text to columns manually.
Whether or not the file lives on a server is totally unrelated to using VBA for a solution.
The real question is: What are you trying to achieve? Your question is about running Text to Columns on a protected sheet, but if you step back from that particular approach, there may be other ways to achieve what you really need to do.
I need to disable the copy/paste in excel 2007. The excel file will be sent to different users so i need a solution where copy/paste is disabled for all users.
I have searched the web but everyone has asked to enable the macros but the problem with that is i will have to enable the macros for every user first before restricting them from copy/pasting.
So looking for a solution where i can write some vba code on sheet to restrict all users from copy/pasting without enabling macros.
Thanks.
Lock the Cells with the Protection Option of Excel manually or lock them programmatically.
Example:
'Range Lock
Worksheets("Sheet1").Range("A1:G37").Locked = True
'Sheet Lock
Worksheets("Sheet1").Protect
EDIT:
Just saw ur new comment, there is no option to use VBA code to block ONLY copy/pasting without allowing Macros in ur Workbook.
You don't need VBA for this.
Go to the review tab
Select protect sheet
Protect with password and take away the ✓ (there should only be one)
I have a excel file that I need to give to a client. It currently comprises of one worksheet but could easily have many more. On the sheet there is a graph and a selection of slicers.
The problem I have is that if I hand this over to the client, they'll see the underlying code and possibly not need our services going forward.
How do I protect the sheet/file and only allow them to view data and operate the slices without seeing any of the background workings?
They must not be able to save a copy, access the SQL code or save changes.
Thanks,
JJ
You can bolt down excel with the protection options so that people can't edit objects and can only select non-locked items. You can also password protect vba and force read-only open of the spreadsheet.
http://office.microsoft.com/en-gb/excel-help/password-protect-worksheet-or-workbook-elements-HP010078580.aspx
There are lots of protection options available but the best thing you can do is reference a report/webpage with the data on instead of doing a direct db connection. This will alleviate a lot of security risks whilst also blackboxing your database.
IMHO
Only lock your spreadsheet down enough to prevent silly mistakes - combined with your data being a blackbox, they will get a usable spreadsheet and be much happier with you than if they felt you were aggresively trying to withold stuff from them. They may run off with your spreadsheet but the extension of trust to them will help discourage the behaviour and at the end of the day, if someone wants to really harvest your IP, they will do so no matter how many controls you have in place.
you also can try to protect VBAProject at the VBA window, something like this:
and put a password
this way the user can manipulate the worksheet without seeing your code, additional to this, block your worksheet like #StephLocke saids.
Your Workbooks can always be vulnerable, but you can lessen the risk to corrupt your code.
PS. My Excel is Spanish but the options are at the same place.
It is possible to protect the worksheets and still allow to interact with the slicers (and only the slicers).
Set each slicer's properties to not "Locked" by right clicking the slicer and selecting "Size and Properties..." and unsetting the "Locked" property.
Protect all other worksheet elements including cells and Pivot Charts in a similar fashion (set their "Locked" property).
Finally, protect the worksheet via “Review” -> “Protect Sheet” and select "Use AutoFilter" as the only action in the selection "allow for all users of this worksheet to".
You might also confer to this answer.