Selected Answer
If you install this code in the code sheet of the worksheet on which you have your final data, you must save the workbook as macro-enabled.
Option Explicit
Dim PrevValue As Variant
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' 27 Oct 2017
PrevValue = Target.Cells(1).Value
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
' 27 Oct 2017
Dim Rng As Range
Dim Refuse As Boolean
Dim R As Long
With Target
' allow changes in row 1 / take no action if ...
' Cell was previously blank or column 5 is included in the selection
Set Rng = Cells(.Row, 5)
If (.Row < 2) Or (Len(PrevValue) = 0) Or _
(Not Application.Intersect(Target, Rng) Is Nothing) Then
Exit Sub
End If
For R = 0 To .Rows.Count - 1
Refuse = (StrComp(Cells(.Row + R, 5).Value, "Final", vbTextCompare) = 0)
If Refuse Then Exit For
Next R
If Refuse Then
' catches changes in columns 1 to 4 (= A:D)
Set Rng = Range(Cells(.Row, 1), Cells(.Row, 4))
If Not Application.Intersect(Target, Rng) Is Nothing Then
MsgBox "This row has final data." & vbCr & _
"No modification permitted." & vbCr & _
"Your change will be undone.", _
vbInformation, "Invalid modification"
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
End If
End If
End With
End Sub
The code will detect any change made in columns A:D. If column E has the word "Final" in it ("final" "FINAL" or "fINAL" will also work) any change made by the user will be undone after displaying a message.
If the user selects multiple cells, modification will be refused if any one of them had "Final" in column 5 (=E). However, if column 5 is included in the selected range no objection will be raised.