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