ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need way to protect cell after data entry (https://www.excelbanter.com/excel-programming/272662-need-way-protect-cell-after-data-entry.html)

Ken[_9_]

Need way to protect cell after data entry
 
We have several logs that various personnel enter
information into. What I would like to do is protect a
cell only after data is entered into to prevent the data
from getting changed at a later point without
authorization. Is there a simple way to do this without
creating custom forms? Thanks.

Ken

Ron de Bruin

Need way to protect cell after data entry
 
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
ActiveSheet.Unprotect
Target.Locked = True
ActiveSheet.Protect
End Sub

Try this event in a sheet module
First change locked to false to some cells or all cells in the worksheet
select the cells and press Ctrl-1 and uncheck locked on the
protection tab

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ken" wrote in message ...
We have several logs that various personnel enter
information into. What I would like to do is protect a
cell only after data is entered into to prevent the data
from getting changed at a later point without
authorization. Is there a simple way to do this without
creating custom forms? Thanks.

Ken




Ken[_9_]

Need way to protect cell after data entry
 
I ended up combining both methods and adding two lines of
my own to protect only the active cell. It works
perfectly. thanks again.

-----Original Message-----
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
ActiveSheet.Unprotect
Target.Locked = True
ActiveSheet.Protect
End Sub

Try this event in a sheet module
First change locked to false to some cells or all cells

in the worksheet
select the cells and press Ctrl-1 and uncheck locked on

the
protection tab

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ken" wrote in message

...
We have several logs that various personnel enter
information into. What I would like to do is protect a
cell only after data is entered into to prevent the data
from getting changed at a later point without
authorization. Is there a simple way to do this without
creating custom forms? Thanks.

Ken



.



All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com