The only thing I managed to do was make a button to block it line by line, different from what I wanted, to make this process automatic...
I tried to make the blocking automatic, but when I press ENTER, the cursor changes lines and the formula doesn't work, because it reads the current line from the cursor. An alternative I found was to create a button to trigger the command. First, the user has to position the cursor on the line of the record that he wants to confirm and, when he clicks on the button, the worksheet blocks the confirmed record line and changes the color of the cells to highlight the confirmed record. These commands also do not confirm registration until the inspector's name is informed ok.
Sub Confirmar()
If MsgBox("Deseja realmente confirmar e bloquear este registro", vbYesNo, "Confirmação") = vbYes Then
Dim Lin As Integer
Lin = ActiveCell.Row
If Sheets("Planilha1").Cells(Lin, 4) <> "" Then
Application.ScreenUpdating = False
Sheets("Planilha1").Unprotect ("omiliso9001")
Sheets("Planilha1").Select
Sheets("Planilha1").Cells(Lin, 1).Locked = True
Sheets("Planilha1").Cells(Lin, 2).Locked = True
Sheets("Planilha1").Cells(Lin, 3).Locked = True
Sheets("Planilha1").Cells(Lin, 4).Locked = True
Sheets("Planilha1").Cells(Lin, 1).Interior.ColorIndex = 4
Sheets("Planilha1").Cells(Lin, 2).Interior.ColorIndex = 4
Sheets("Planilha1").Cells(Lin, 3).Interior.ColorIndex = 4
Sheets("Planilha1").Cells(Lin, 4).Interior.ColorIndex = 4
ActiveSheet.Protect ("omiliso9001")
Else
MsgBox "O registro somente pode ser confirmado quando informado o nome do inspetor!", vbInformation, "ERRO"
End If
End If
Application.ScreenUpdating = True
End Sub
prot bot.jpg