Greetings I have a workbook with many sheets and i want a macro to protect all the worksheets with certain settings except for one sheet, sheet 3.
I have borrowed some code from this page that I cannot get to work and I would appreciate any help. the code should also have an if statement that unprotects sheet 3 but i don't know how to do that either. I just get syntax errors
I am using Excel 2010 and I have a password protected workbook with password protected sheets that uses several macros. Most of them, in order to run, have to un-protect the sheet and then re-protect it again. This has been accomplished easily enough by adding ActiveSheet.Unprotect Password:= "mypassword" and ActiveSheet.Protect Password:= "mypassword" to the appropriate places in the script. All of my macros, which do various things like sorting and moving data, deleting blank rows, displaying dialog boxes containing warning messages etc. run fine.
My problem is this: when I password protect the sheets manually, I have checked the following options in the "Protect Sheet" dialog box. Under "Allow users of this worksheet to" I have checked 1)Select unlocked cells and 2)Format cells. After entering my password and closing the dialog box my sheet is protected, but I can edit cells in the manner my allowances permit. However, once I run any of the macros that un-protect and re-protect the sheet, I remain able to select and edit unlocked cells (practically, for my purposes, this means that I can input data which will appear in the default font size and color of the sheet) but I cannot format cells (which, practically, for my purposes would allow me to occasionally change the font color and size of the data). Naturally, after running a macro, the other cell-formatting options are unavailable to me as well. Is there any way to get my manual selections to remain in place after running a macro that functions as mine do? Or is there any way to make my manual selections the default settings for a protected sheet?
I want a sheet to copy and paste into another worksheet, I have that code and its working fine, but what I also want to do is for the sheet to be protected,so the code would be, copy, unlock, paste, lock, save.
Here is the code I have so far. I know i have to include ActiveSheet.Unprotect "passowrd" ActiveSheet.Protect "password", but I dont know where to include that last part of the code.
I have two macro buttons on a page that hide and unhide columns. When I got to protect the sheet .. the buttons no longer work and ask me to DEBUG. Is there a way to have macro buttons performing tasks AND have the sheet still protected?
In the protect sheet window .. am I have ticked is
Macro to Run all tabs in a workbook and prompt a pop up asking about sheet protection for each tab, such as Select locked cells, and select unlocked cells.
I am trying to design a tool which dynamically results in different cells depending on users inputs. Yet, I am willing to protect most of the cells to avoid any user involuntarily (or voluntarily!) modifying the formulas/contents of the calculated (and locked) cells. Is there any way to protect my sheets, allowing only a certain macro to modify the locked and protected cells?
I need a macro that I can have in any workbook enabling me to protect / unprotect the workbook that I have currently opened with a set password (let say "Password")
I would link this macro to a button in excel 2002. I have try the following but it doesnt work
Would it be possible that the button (first) works (second) understand whether or not protect / unprotected and do the opposite?
Sub Protect Activeworkbook.protect password:="password", structure:=FALSE, Windows:=false End Sub
I have been really trying to get this sorted myself and I can get it to work with one exception. I can't get the sheet to lock with a password. It locks, but if I try to unlock it again, it does so without prompting me to enter a password.
Essentially I am wanting to unprotect two sheets, unlock the cells that were previously locked (so users couldn't enter data in them when the sheet is protected), then reapply the same password to protect the sheet, but now they will be able to enter data in the unlocked range of cells).
The second macro is to reverse the changes made in the first and 're-lock' the unlocked cells) (and again apply the same password to the sheet).
I have a protected worksheet containing an SQL query. I have two cells on the worksheet unlocked so that users can enter fresh parameters to feed the query. Because I have to use MS Query to interrogate our SQL server (current IT decree), the query won't support parameters directly when the query cannot be represented graphically - so I have to manually edit the sql command text and then refresh the query - or at least that was why I wrote the code below
The problem: My macro won't unprotect the sheet before it calls the SQL.it therefore won't update the sheet to detail the DSN, command text and number of parameters (latter should be 0) - info just used to verify queryit won't run the query / return the data as the sheet is still protected Comment: I have had to remove sheet protection in order to allow the sql to execute and return data. If protection is removed, the query does execute and return data ( changes in the "parameter" cell contents do cause the query to be correctly modified) I could comment out the debug info but the query still doesn't return data if the sheet is protected.
Activesheet And worksheets(ndx) where ndx has been defined As ActiveSheet.Name I apologise If my post Is difficult To follow - especially the code.
I have a sheet that is password protected. I have this code attached to a command button. It will unlock the worksheet, autofilter it, print it, unfilter it, and password protect the sheet again. However it is protecting it without a password. I need to have it protected with the password so that someone will not be able to just go to tools to unprotect the sheet.
Private Sub CommandButton1_Click() ActiveSheet.Unprotect "rainforest" Columns("O:O").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:=">0", Operator:=xlAnd ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True Selection.AutoFilter Field:=1 Selection.AutoFilter ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowSorting:=True, AllowFiltering:=True End Sub
I make excel file that contains certain formulas and graphs. Now I wonder is that a way for protect that file so it can be used only on specific cumputer, so if someone copy that file and paste it on their computer file will not work properly
My user form has a line of code that protects the sheets and does not allow any changes and selection of cells. It worked great on my personla computer.
Running the file on another computer the code does not protect the sheet. The strange thing is that if I go the Tools>Protection> the options is set to Unprotect. That measn that the code actually has protected the sheet but I am still able to make chages. If I manually unprotect and again protect the sheet, it is protected till the time close the file and open it again.
Excel file 1 has: Sheet 1: Account numbers and balances Sheet 2: Mapping information detailing what account in file 1 is to go to a different account number in file 2.
Excel file 2 has: Lots of sheets where information is to be keyed in.
This is a very manual process with lots of data entry to input into accounting forms I send to our head office. The "file 2" has sheet protection on all sheets so that formats, data, columns etc etc cannot be altered and only certain fields updated.
I think I have successfuly written my scripts to loop through the account values and map those to all spots in all sheets they are referenced to on the mapping document, however I am getting an error message that the "cell or chart you are trying to change is protected and therefore read-only".
Basically I look through the sheet and look for my mapping code, if that matches, I add the balance to the exisitng value of the cell, in the next column. i.e. if B2 has the corresponding code I will add the balance to the current value of cell C2.
This is an extract of the code where I am looking up the sheet:
Dim ws As Worksheet For Each ws In Sheets If Left(ws.Name, 2) "OP" Then Dim rg As Range Dim cl As Range Set rg = Range("A1:IV65536") For Each cl In rg If ActiveCell.Locked = False Then If cl = kessanid Then cl.Offset(0, 1).Value = acctvalue End If End If Next cl End If Exit For Next ws
It may be that because the sheet is protected as a whole nothing can be done but I was hoping that because I am going to the specific cell which allows input I should be able to do this.
I am using the following code to protect/unprotect a sheet in a tool that i am working on, which seems to work great. It unprotects the sheet runs the code inbetween the two liens of code and then protects the sheet again.
The issue I am having is if i want to go in and edit the sheet without running the code it will not let me. When I go in and type the password to unprotect it says it is invalid. I have typed it exactly how the code reads. I have even tried including the quotes but no luck.
1) I need to have code to protect the sheet that my user form is writing to. In other words, when the information from the user form is populated to the sheet, I want that sheet protected by a password that I set where I can unlock it, but no one else can.
2) I need to protect my VBA code with a password, I do not know how to do this, I have looked everywhere. I do however think this is something simple and I will kick myself once I find out where it is.
I'm trying to protect a sheet so that it can be unhidden only if you know the password.
This is because I have a macro that updates some of the cells and there are some people (and only those) that should be able to access it quickly and easily. -> can't use VeryHidden or cell lock.
Can you protect a sheet name from being changed by a user?
Can you protect a sheet from being deleted by a user?
I have an Excel 2003 file available to all employees on a network. There are three sheets. Two sheets are protected with passwords and users can not enter any data on them. They are used to hold data needed by the third sheet.
The third sheet (named FORM) is for user input. FORM has a majority of the cells protected with a password. Users can enter information, save the file, print the sheet, or make duplicates of the sheet. The sheet contains data validations, conditional formatting, and formulas.
I have some VBA which acts on all the sheets (even those which users might have inserted) making them visible (very hidden) or not. When a user opens the file (whether for the first time or after adding sheets), I always want them to have FORM unhidden. I have VBA to do this but what if a user changes the name of the sheet? CRASH!
I have a worksheet where the users need to enter time. I have a macro that captures the time when the user hits Ctrl + t
What I want now is a code which protects the cell after entering the time with Ctrl + t.
I tried to do it, but my macro only works when I don't set any passwords to protect the sheet. How can I pass the password to the code and protect the sheet after the code to capture the time is being executed.
I find the protection options of Excel confusing. I have a pivot table. Alonside it our a few formula columns. I want to protect only the columns outside the pivot but can not get it to work. I tried this:
1) Highlight entire sheet 2) Format Cells Protection - remove checkmark from: Lock Cells 3) Highlight 4 rows outside pivot 4) Format Cells Protection - place checkmark in Lock Cells 5) Tools Protection Sheet - supply password
The result is that the 4 columns outside the pivot are indeed locked BUT SO IS THE PIVOT...ie you can not utlize the dropdowns!
It must have something to do with the pivot, on a regular sheet (no pivot) it works fine. Further if, while Protecting the sheet, I click the: allow Pivot table reporting box, then it allows dropdown usage but blows up as soon as you select something with an error about not being able to redisplay selected itemsbecause of protection being on....
Is there anyway to protect each sheet at one time? I have about 70 sheets and I dont wan to go to each and protect them. They all have the same password so I hope thats not a problem.
Just wondering if there is a way to prevent users from changing tab/ sheet names in a workbook? Either via sheet protection (I couldn't find any option) or using code.
Is there is any way we can protect sheet in such a way that; if user - Mr. A inputs his password he can only go and is able to input his data in sheet 1.
I've a file which have multiple sheets say about 80 tabs are present. My colleague only works on one of the tab (sheet) enters data, that file is placed on our general sharing folder I want to know if it is possible that I can assign protection in such a way that when she enters her password she is able to input data only on the sheet in which she works and cannot roam around to other sheets?
Or is it possible that on first sheet there is username or password can appear? And if the data inputting person opens that file and enter her password option appear which can take her to that particular sheet? And if a guest open that file he/she can only view particular sheets which contain reports?
I am working with Excel 2003 and find that the default "Protect Sheet" dialog box opens with a default of both the "Select locked cells" as well as the "Select unlocked cells" check boxes marked. Is there a way to change this default?