I want to have each row on a spreadsheet lock when I'm finished filling in the information. Basically after the cell in the last column is populated, I want the row to lock to any further editing without a password. So far I've taken bits and pieces of code and tried to make it work for 1 line before I attempt to loop it through the rest of the spreadsheet. Help with either of these tasks will be greatly appreciated. Here's what I have so far:
Private Sub Worksheet_Change(ByVal target As Range)
If Not Intersect(target, Me.Range("AH2")) Is Nothing Then Run Row_Lock
End Sub
Sub Row_Lock(ByVal target As Range)
If target.Address Is Not "AH2" Then Exit Sub
ActiveSheet.Unprotect "password"
If target <> "" Then
Cells.Select
Selection.Locked = False
Range("A2:AH2").Select
Range("A2:AH2").Locked = True
ActiveSheet.Protect "password"
End If
End Sub
Right now I'm getting an "Argument not optional" error message when I run the code.
Private Sub Worksheet_Change(ByVal target As Range)
If Not Intersect(target, Me.Range("AH2")) Is Nothing Then Run Row_Lock
End Sub
Sub Row_Lock(ByVal target As Range)
If target.Address Is Not "AH2" Then Exit Sub
ActiveSheet.Unprotect "password"
If target <> "" Then
Cells.Select
Selection.Locked = False
Range("A2:AH2").Select
Range("A2:AH2").Locked = True
ActiveSheet.Protect "password"
End If
End Sub
Right now I'm getting an "Argument not optional" error message when I run the code.