"Are you sure" Prompt

D

Dan

Open sheet with certain fields with 0 as the default
values, but if you put $$ in them and later try to over
write them get a "are you sure" prompt.
 
M

medialint

Was that a question or a statement?

Is it your desire to achieve this behavior?

Is it your desire to avoid this behavior?
 
R

Rob van Gelder

Worksheet code:

Private blnTrigger As Boolean
Private Const cID = "$$"

Private Sub Worksheet_Change(ByVal Target As Range)
If blnTrigger Then
If MsgBox("Are you sure?", vbOKCancel, "Sure?") = vbCancel Then
Application.EnableEvents = False
Target.Value = cID
Application.EnableEvents = True
End If
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
blnTrigger = (Target.Value = cID)
End Sub
 
Top