I wanna proctect a specific area or only rows in a excel sheet where the user can make changes.
the red area should be protected, is this possible and realizeable with vba? And is it possible to make the protec scalable, when the user insert a new line?
Thanks for your suggestion!, I know my english is no quite good... -.-
I know ther are exist many question about this subject but i didn't found the right answer in following question:
How to protect cells in Excel but allow...
Different cell protection in...
I hope you can help me...
You first have to pick which cells aren't protected by setting the Locked to false
Worksheets("Main").Range("B2:E4").Locked = False
Then you have to use to modify the cells
Worksheets("Main").Protect UserInterfaceOnly:=True
Related
it sounds simple but I am struggling
Do you know how to password protect a single sheet (there’s multiple sheets in the work book) so that you can only view it with a password. So the user can’t see it with the ‘read only’ option, I can only seem to be able to do it to the whole workbook. But just need it for 1 sheet only?
Thanks
A visually undiscoverable and password-protected sheet. C4 has test, but you can't see it. I also removed gridlines for grins.
I thought about this for a bit, and here's my best answer:
Change the cell and font colors to be the same
Protect the sheet and disable the ability to change ANYTHING.
Hide the sheet, if necessary.
This would force someone to:
Have the password.
Select All fields on that page, and then change the font color.
If memory serves correctly, this can easily be hacked by importing the workbook to Google Sheets, converting it to a Sheet, and then re-exporting it back to XLSX. In other words, don't be trying to hide anything TOO sensitive here.
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?
This is my first post and I'm not particularly versed in code, so please be patient and bear with me as I try to explain my query as clear as possible.
I have a spreadsheet which has a data validation tab where I can either choose "Actual" or "Budget" - depending on what I choose these figures will then be loaded into a SQL Table.
What I want to do, is when I choose "Budget" as one of my two options, I would like it to ask me for a password in my VBA Code.
So from the following drop down options, they can choose either and this is what I want to happen
Actual - someone else can edit the figures
Budget - they would need a password first before any editing.
I hope that makes sense and that someone can assist me, thanks in advance!
Dan
You can use the protect function from excel :
Excel protect function
VBA protect function
It can be accessed with VBA like this :
'Lock, see second link for a full list of availables options on what is locked or not
ActiveSheet.Protect "yourPasswordHere", DrawingObjects:=True, Contents:=True, Scenarios:=True
' Unlock
ActiveSheet.Unprotect "yourPasswordHere"
Depending on how your worksheet and VBA is built, you may protect the sheet when the user select the budget, and unprotect when he changes to the other options.
However, this solution make your budget table still visible for the user, he can look at it without password, but he can't modify the values.
This is my problem. I need my VBA macro to make a particular number of top rows (let say, N) in an Excel spreadsheet read-only, so a user would not be able to change them by mistake. Still, I need a user to be able to edit and change other rows in the same spreadsheet. If I do something like
Range("A1:J10").Select
Selection.Locked = True
ActiveSheet.Protect Contents:=True
then the whole spreadsheet is getting locked. If, on the other hand, I omit ActiveSheet.Protect Contents:=True line (do not protect the sheet), nothing is getting locked at all.
So, the question is: is it possible to block only the specified rows, while allowing user to edit the rest of them? I would appreciate the VBA code doing that.
By default all cells on a sheet are Locked=True, but this has no effect until the sheet is protected.
You will need to unlock the cells you want to stay editable before the sheet is protected.
I am in a very strange situation in VBA. I am new to VBA and struggling since a couple of days in solving this problem.
I want to Lock the top three rows and the first three columns of my excel sheet for editing. However, these cells contain formulas, which I don't want the end user to edit and make changes. So basically, what I need is, the cells should perform all the operations, but should not be edited. How can, I do it in VBA. I am using Excel 2010.
One more thing, I have a button in the top rows ($B$2:$C$3) occupying four cells. This button is assigned to a macro which does the job of clearing contents in all the cells except the cell I Intend to lock. In short, in the other cells, the user can export data from a notepad and thereafter the formulas in the locked cell will do the job. When the user has to export new set of datas, he will cick on the button which is in ($B$2:$C$3), which clears the existing data and the user can imprt new set of dat from the notepad.
When I use
Worksheets("Sheet1").Range("B2:C3").Locked = False
Worksheets("Sheet1").Protect UserInterfaceOnly:=True
my button in ($B$2:$C$3) is not working properly. Any help from anybody will behighly solicited. Thanks a lot in advance.
try this:
Worksheets("Sheet1").Range("B2:C3").Locked = true
Worksheets("Sheet1").Protect UserInterfaceOnly:=True
This should fix the problem.