Hi Guys,
I'm new to this group and I need your help. The scenario is this: I have a table using a data entry form to populate the cells and I want to lock each cell on the rows once data is already entered but would allow me to continue entering new set of data for the new row. I have applied this VBA:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target = "" Then Exit Sub
If Intersect(Target, Range("A2:H20000")) Is Nothing Then Exit Sub
ActiveSheet.Unprotect Password:="yourpassword"
Target.Locked = True
ActiveSheet.Protect Password:="yourpassword"
ActiveSheet.EnableSelection = xlUnlockedCells
End Sub
but it doesn't work until you try and enter the data again on the cells manually and not by the data entry form. Is there a way I could get around this? How do we reference the table cells for the Range? Thanks for your help.
I'm new to this group and I need your help. The scenario is this: I have a table using a data entry form to populate the cells and I want to lock each cell on the rows once data is already entered but would allow me to continue entering new set of data for the new row. I have applied this VBA:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target = "" Then Exit Sub
If Intersect(Target, Range("A2:H20000")) Is Nothing Then Exit Sub
ActiveSheet.Unprotect Password:="yourpassword"
Target.Locked = True
ActiveSheet.Protect Password:="yourpassword"
ActiveSheet.EnableSelection = xlUnlockedCells
End Sub
but it doesn't work until you try and enter the data again on the cells manually and not by the data entry form. Is there a way I could get around this? How do we reference the table cells for the Range? Thanks for your help.