Disabling Cell Editing
You might try using the below code.
1. Format the sheet with cells unlocked
2. put it into a worksheet change event
3. start the code with this If to capture the column you want to capture
the change
If target.Column = 2 then
4. restrict the code to work on itself rather than all worksheets.
5. add a line in the code (just before the code re-protects)
Target.Row.Locked = True
than the row will be protected and the user cannot select it.
(you may need to provide an unlock code to make corrections)
Also this works in Excel 2000 and may need modifications for later versions.
Select UnProtected Cells ONLY
This will prevent users from clicking on protected cells on all
worksheets. Therefore, the warning message will not appear. The code
must be enterred in the ThisWorkbook module.
Note that the EnableSelection property must be reset each time the
workbook is opened as it defaults to xlNoRestrictions. The
worksheet(s)
must first be unprotected to set the EnableSelection property and then
must be protected for it to take effect.
Private Sub Workbook_Open()
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
WS.Unprotect 'Password:="wxyz"
WS.EnableSelection = xlUnlockedCells
WS.Protect 'Password:="wxyz", UserInterfaceOnly:=True
Next
End Sub
Regards,
Greg Wilson 5/3/03
--
steveB
Remove "AYN" from email to respond
"programmingrookie" wrote in
message ...
I have a two columns in a worksheet, one holds first names and the other
holds last names. I want to disable the cells after names have been
entered
to keep a user from recycling cells with new names. Is this possible?
|