Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Protect Cells
Is it possible to protect a cell after someone inputs data into it. I want
to develop a sheet where people can sign up for a training session but after saving the file the cell(s) that have names in them, the cells cannot be changed. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Protect Cells
Yes.
Let me assume that I wish to protect the following range of cells D 83 to D 85 (inclusive) in a particular worksheet. In EXCEL 2007 take the following action:- 1. Highlight all the cells in your Worksheet by clicking in the box to the left of A and above 1 in the top left hand corner. This should cause your Worksheet to become highlighted. 2. Hit Ctrl-1 to launch Format Cells. 3. Protection tab. 4. Remove the green tick from the box called:- Locked - then hit OK. 5. Highlight cells D 83 to D 85 inclusive in your Worksheet. This should cause those cells to become highlighted. 6. Ctrl-1 to launch Format Cells once more. 7. Protection tab. 8. Place a green tick from the box called:- Locked - then hit OK. 9. Home / Cells group / Format / Protect Sheet / place a password in the box called:- Password to unprotect sheet (I have used password called test). At this point there are 3 cells on this window that should have a green tick in them. They a- Protect worksheet and contents of locked cells Select locked cells Select unlocked cells After you have entered your password hit OK and then put the password in again in the box called:- Reenter password to proceed. - and then hit OK. Save the file at this point if required. 10. Close and re-open the file. Now try to amend any of the cells D 83 to D 85 in the Worksheet and you will not be able to. 11. Now try to amend any other cells (apart from D 83 to D 85) and you will be able to amend them. Please hit Yes if my comments have helped. Thanks. "Phil K" wrote: Is it possible to protect a cell after someone inputs data into it. I want to develop a sheet where people can sign up for a training session but after saving the file the cell(s) that have names in them, the cells cannot be changed. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Protect Cells
Phil
Couple of ways to do this. 1..Lock cells immediately when a name is entered or 2. Lock the cells when you save the workbook. Method for 1. Unlock all cells and protect the sheet with a password "justme" or whatever you choose. Right-click on sheet tab and "View Code". Copy/Paste into that module. Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo enditall Application.EnableEvents = False If Target.Cells.Column = 1 Then 'edit to suit Me.Unprotect Password:="justme" 'edit to suit n = Target.Row If Me.Range("A" & n).Value < "" Then 'edit "A" to suit Me.Range("A" & n).Locked = True End If End If enditall: Application.EnableEvents = True Me.Protect Password:="justme" End Sub Method for 2. Unlock all cells. Protect sheet as above. In Thisworkbook module paste this code. Private Sub Workbook_BeforeSave(ByVal SaveAsUI _ As Boolean, Cancel As Boolean) Dim rng As Range Dim rng1 As Range Dim wksht As Worksheet Set wksht = Sheets("Sheet1") wksht.Activate wksht.Unprotect Password:="justme" Set rng = Range(Range("A1"), Cells(Rows.Count, 1).End(xlUp)) Set rng1 = rng.Cells.SpecialCells(xlCellTypeConstants) rng1.Locked = True wksht.Protect Password:="justme" End Sub Gord Dibben MS Excel MVP On Thu, 14 Jan 2010 18:15:01 -0800, Phil K wrote: Is it possible to protect a cell after someone inputs data into it. I want to develop a sheet where people can sign up for a training session but after saving the file the cell(s) that have names in them, the cells cannot be changed. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I protect cells or a range of cells in excel spreadsheet? | Excel Worksheet Functions | |||
Protect Cells | Excel Discussion (Misc queries) | |||
Protect only certain Cells? | Excel Discussion (Misc queries) | |||
Protect Cells ??? | Excel Discussion (Misc queries) | |||
Protect Cells | New Users to Excel |