Locking Cells in Table

NRC

New Member
Joined
Aug 21, 2022
Messages
1
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2011
  5. 2010
Platform
  1. Windows
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.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,214,548
Messages
6,120,146
Members
448,948
Latest member
spamiki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top