ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   "Are you sure" Prompt (https://www.excelbanter.com/excel-programming/302745-you-sure-prompt.html)

dan

"Are you sure" Prompt
 
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.

medialint[_2_]

"Are you sure" Prompt
 
Was that a question or a statement?

Is it your desire to achieve this behavior?

Is it your desire to avoid this behavior?

"Dan" wrote:

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.


Rob van Gelder[_4_]

"Are you sure" Prompt
 
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


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Dan" wrote in message
...
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.





All times are GMT +1. The time now is 06:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com