Enter Event Code
Use the Worksheet_Change
event, which must be placed inside the spreadsheet where the data is located.
For example, in my case it was in Sheet1:
Codeforacell
Thecodeisfiredeverytimetheworksheethasanychangesandhasaconditionalifthevalueisequalto"Store 10".
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo CleanExit
Application.EnableEvents = False
If Target.Value = "Loja 10" Then
Target.Value = ""
MsgBox ("Não existe Loja 10!")
End If
CleanExit:
Application.EnableEvents = True
On Error GoTo 0
End Sub
Note: The event can cause slowness, since every time a cell changes. This event will fire.