Cell blocking

Closed
Report
-
Posts
2829
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
November 22, 2021
-
Hello,
i need to block the cell after entering data to it
which means i need each cell to accept entry one time only
note.the worksheet must be protected
ths all



1 reply

Posts
2829
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
November 22, 2021
490
Hi Moon Spell,

Start by unblocking all cells:
Hit Ctrl + a to select all cells.
Hit Ctrl +1 to go to cell properties.
Go to the protection tab and uncheck the blocked box.
Hit OK.

Now implement the code below by right-clicking the sheets tab and select view code. Paste the code in the big white field.
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect
Target.Locked = True
ActiveSheet.Protect
End Sub


Now you will only be able to input a value once. Unless you manually unprotect the sheet.

Best regards,
Trowa