![]() |
Lock & Protect Cells With Data
Hi Everyone,
I have 6 Users who Input Data ( in a Shared Workbook ) in their OWN Worksheet. Each Worksheet is Protected ( So they can ONLY Select Unlocked Cells ) with a Password and ALL Cells are Locked Except for the Range "C4:H6" ( These are the ONLY Cells in which Data can be Entered by the User ). They will Enter Data ( Numeric ) in Cells "C4:C6" for Period 1, they MUST be Able to Amend the Data if Necessary. When they are Happy with the Results they will Save the File. What I would like is that when they Open the File to Input Data for Period 2 in Cells "D4:D6" they CANNOT Change the Data Already Entered for Period 1, and the Same for the Rest of the Periods. Is there a way to "Lock" the Cells that are " " ( Blank OR Empty ) so that they CANNOT be Changed. There is a Button Called "Finished" that they Click to Hide their Worksheet Before Saving the File, Perhaps the Code to "Lock" the Cells could be Added to that. The Code Behind the Finished Button for Group 1 is :- Sub Group_1_Finished() UserName = Sheets("Login & Logoff").Cells(2, 3) Password = Sheets("Login & Logoff").Cells(3, 3) If UserName = "Group 1" And Password = "Group 1 Password" Then Sheets("Group 1").Visible = xlVeryHidden Range("C3") = "" Else Range("C3") = "" MsgBox "The Group 1 Password You Have Entered Is Invalid, Please Try Again.", _ vbCritical, "Invalid Group 1 Password" End If End Sub Thanks in Advance All the Best Paul |
Lock & Protect Cells With Data
Thanks Fran,
I have Searched High and Low for a Macro to do this. I know that it Probably Needs to be a Macro for Worksheet_On_Open Event which will be Placed in the Worksheet Code, or some Code to be Added to the Code Already Setup for the "Finished" Button. Thanks Again All the Best Paul "Fran" wrote in message ... Seems like you should be able to write a macro. If you named a range for the input cells for Periods 2, 3, 4 etc. and used an IF statement with a "Date more than" a certain date - then they're locked - if not, they're open. I'm not all that VBA literate but have written plenty of macros by clicking. You sound like you're pretty VBA literate. "Paul Black" wrote: Hi Everyone, I have 6 Users who Input Data ( in a Shared Workbook ) in their OWN Worksheet. Each Worksheet is Protected ( So they can ONLY Select Unlocked Cells ) with a Password and ALL Cells are Locked Except for the Range "C4:H6" ( These are the ONLY Cells in which Data can be Entered by the User ). They will Enter Data ( Numeric ) in Cells "C4:C6" for Period 1, they MUST be Able to Amend the Data if Necessary. When they are Happy with the Results they will Save the File. What I would like is that when they Open the File to Input Data for Period 2 in Cells "D4:D6" they CANNOT Change the Data Already Entered for Period 1, and the Same for the Rest of the Periods. Is there a way to "Lock" the Cells that are " " ( Blank OR Empty ) so that they CANNOT be Changed. There is a Button Called "Finished" that they Click to Hide their Worksheet Before Saving the File, Perhaps the Code to "Lock" the Cells could be Added to that. The Code Behind the Finished Button for Group 1 is :- Sub Group_1_Finished() UserName = Sheets("Login & Logoff").Cells(2, 3) Password = Sheets("Login & Logoff").Cells(3, 3) If UserName = "Group 1" And Password = "Group 1 Password" Then Sheets("Group 1").Visible = xlVeryHidden Range("C3") = "" Else Range("C3") = "" MsgBox "The Group 1 Password You Have Entered Is Invalid, Please Try Again.", _ vbCritical, "Invalid Group 1 Password" End If End Sub Thanks in Advance All the Best Paul |
All times are GMT +1. The time now is 05:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com