azdisplcdgrl
New Member
- Joined
- Aug 2, 2016
- Messages
- 1
Hello. I am a noob to excel vba. I found this great code that gives me part of what I need. However, I do not want columns C & F locked after entry. I've tried a few things, but it's not working. Can anyone help?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Column = 4 Then
confirm = MsgBox("Do you want to sign up for this OT?" & vbCrLf & "By selecting Yes, you agree to accept OT, once selected, this cannot be changed.", vbYesNo, "confirm Entry")
Select Case confirm
Case Is = vbYes
Dim Cell As Range
With ActiveSheet
.Unprotect Password:="Kaia"
.Cells.Locked = False
For Each Cell In ActiveSheet.UsedRange
If Cell.Value = "" Then
Cell.Locked = False
Cell.Locked = True
End If
Next Cell
.Protect Password:="Kaia"
End With
Case Is = vbNo
Application.Undo
End Select
End If
Application.EnableEvents = True
End Sub