Hello all, first time posting here, having a bit of trouble with this project and am hoping to find some expertise. The first column of my sheet contains a drop box with "Yes." When that is triggered I want a timestamp in the second column, then automatically lock the first and second columns. There will be a bunch of editable information until column 8 which contains a drop box of status updates, once "Complete" is chosen, I want the entire row moved from the "Pending" sheet to my "Completed" sheet. Hopefully my code doesn't look to horrendous. Any and all help would be so much appreciated! I would have about say 200 rows if its necessary to know the locking range A2:B200. The road block I have run into is properly locking the cells and unlocking them when time to complete a row.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.column = 8 Then
If Target = "Complete" Then
Application.EnableEvents = False
nxtRow = Sheets("Completed").Range("H" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy _
Destination:=Sheets("Completed").Range("A" & nxtRow)
Target.EntireRow.Delete
End If
End If
Application.EnableEvents = True
If Target.column = 1 Then
If Target = "Yes" Then
Application.EnableEvents = False
confirm = MsgBox("Are you ready to start another entry?", vbYesNo, "Cell Lock Confirmation")
Select Case confirm
Case Is = vbYes
Dim cell As Range
With ActiveSheet
.Unprotect Password:="test"
.Cells.Locked = False
For Each cell In ActiveSheet.UsedRange
If cell.Value = "" Then
cell.Locked = False
Else
cell.Locked = True
Target.Offset(0, 1) = Format(Now(), "m/d/yyyy - h:mm:ss AM/PM")
End If
Next cell
.Protect Password:="test"
End With
Case Is = vbNo
Application.Undo
End Select
End If
End If
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.column = 8 Then
If Target = "Complete" Then
Application.EnableEvents = False
nxtRow = Sheets("Completed").Range("H" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy _
Destination:=Sheets("Completed").Range("A" & nxtRow)
Target.EntireRow.Delete
End If
End If
Application.EnableEvents = True
If Target.column = 1 Then
If Target = "Yes" Then
Application.EnableEvents = False
confirm = MsgBox("Are you ready to start another entry?", vbYesNo, "Cell Lock Confirmation")
Select Case confirm
Case Is = vbYes
Dim cell As Range
With ActiveSheet
.Unprotect Password:="test"
.Cells.Locked = False
For Each cell In ActiveSheet.UsedRange
If cell.Value = "" Then
cell.Locked = False
Else
cell.Locked = True
Target.Offset(0, 1) = Format(Now(), "m/d/yyyy - h:mm:ss AM/PM")
End If
Next cell
.Protect Password:="test"
End With
Case Is = vbNo
Application.Undo
End Select
End If
End If
Application.EnableEvents = True
End Sub