Hi everyone,
I have a problem: I have an excel file that is shared by a number of people: First is filled by one person and then validated by some others (with their names in a combobox and password). Whenever the last person validates (column F), I would like to block the entire row (A:AF).
I am using the following code that I have adapted:
Private Sub block (ByVal Target As Range)
If Intersect(Target, Columns("F")) Is Nothing Then Exit Sub
If Target.Value <> "" Then
Range("a" & Target.Row, "af" & Target.Row).Locked = True
Else
Range("a" & Target.Row, "af" & Target.Row).Locked = False
End If
End Sub
Nevertheless, this doesn't work. Is it the code, or maybe because the file is protected? Or even because the cells are unlocked (format cells > protection > unlock)?
Thank you for your help.
I have a problem: I have an excel file that is shared by a number of people: First is filled by one person and then validated by some others (with their names in a combobox and password). Whenever the last person validates (column F), I would like to block the entire row (A:AF).
I am using the following code that I have adapted:
Private Sub block (ByVal Target As Range)
If Intersect(Target, Columns("F")) Is Nothing Then Exit Sub
If Target.Value <> "" Then
Range("a" & Target.Row, "af" & Target.Row).Locked = True
Else
Range("a" & Target.Row, "af" & Target.Row).Locked = False
End If
End Sub
Nevertheless, this doesn't work. Is it the code, or maybe because the file is protected? Or even because the cells are unlocked (format cells > protection > unlock)?
Thank you for your help.