#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 833
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I protect cells or a range of cells in excel spreadsheet? Abundance Excel Worksheet Functions 1 July 28th 09 11:03 PM
Protect Cells Carl R[_3_] Excel Discussion (Misc queries) 0 February 3rd 09 04:04 PM
Protect only certain Cells? Katee Excel Discussion (Misc queries) 3 January 27th 07 05:40 PM
Protect Cells ??? Jcraig713 Excel Discussion (Misc queries) 2 January 27th 06 02:57 PM
Protect Cells enquirer New Users to Excel 1 April 18th 05 10:30 PM


All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"