I need to use VBA code to lock a specific set of cells once data is entered in ONE cell. Context: The user will be going along a row entering user name, pass, etc. Some cells in the row are locked and some are unlocked for where they need to enter data, but once they answer their data in the last cell, I want all of the previously unlocked cells in that row to lock.
I'm having trouble getting this to work without it constantly updating and locking the cells over and over. This is what I have right now.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
ActiveCell.Select
If Range("O22") <> "" Then
ActiveSheet.Unprotect
Range("F22,G22,J22,K22,L22,O22").Select
Selection.Locked = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
End Sub