Lock cells

L

ladengast

Hi!
Is it possible to adjust excel in a way that cells are automaticall
locked after entering a figure/ value? Only cells should be locked tha
are already containing a value.

Thank you for your help!

br Fran
 
P

Paul B

Frank, here is one way, change the range to your range and unlock the cells
in that range before you put the macro in.


To put in this macro right click on the worksheet tab and view code, in the
window that opens paste this code, press Alt and Q to close this window and
go back to your workbook. If you are using excel 2000 or newer you may have
to change the macro security settings to get the macro to run.


Private Sub Worksheet_Change(ByVal Target As Range)

'Automatically Protecting After Input

'unlock all cells in the range first




Dim MyRange As Range



Set MyRange = Intersect(Range("A1:D100"), Target)

If Not MyRange Is Nothing Then

Unprotect password:="123"

MyRange.Locked = True

Protect password:="123"

End If

End Sub
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
** remove news from my email address to reply by email **
 
Top