Hi guys the following formula works great and if text is written over then it will put the original text back in automatically.
only problem is if i hit delete on the keyboard it deletes it - i want to stop this delete button from working.
any1 know how? please see macro belo
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sel, sv
Dim rng As Range, cell As Range, plan As Range
Dim rng2 As Range, cell2 As Range, WO As Range
Set sel = Selection
sv = sel.Value
Application.EnableEvents = False
On Error GoTo e
Application.Undo
Set rng = Range([A1], [IV1].End(xlToLeft))
For Each cell In rng
If cell = "Plan" Then
If plan Is Nothing Then
Set plan = Intersect(cell.EntireColumn, ActiveSheet.UsedRange)
Else
Set plan = Union(plan, Intersect(cell.EntireColumn, ActiveSheet.UsedRange))
End If
End If
Next
If Not plan Is Nothing Then
Set rng2 = Application.Intersect(Target, plan)
If Not rng2 Is Nothing Then
For Each cell2 In rng2
If cell2 = "WO" Then
MsgBox "You cannot change " & cell2.Address(False, False)
GoTo e
End If
Next
End If
End If
sel.Value = sv
e:
Application.EnableEvents = True
End Sub
Bookmarks