Locking columns under condition and unlocking/moving rows to next sheet under next condition

briguy89

New Member
Joined
Jul 31, 2018
Messages
2
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
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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