Yes/No Msgbox question - set Default response to 'No'

jfarc

Active Member
Joined
Mar 30, 2007
Messages
316
In the sample question Msgbox below the 'Yes' answer is the Default (If user simply hits the 'Enter' key as their response).

Code:
If vbYes = MsgBox("My Question", vbYesNo, "Confirm Answer") Then

Is there a way to have exactly the same question Msgbox as above, but have the 'No' as the Default?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Try

Code:
If vbYes = MsgBox("My Question", vbYesNo + vbDefaultButton2, "Confirm Answer") Then
 
Upvote 0
Perfect VoG! Just what I was looking for.

Thanks Kenneth, but that still left the 'Yes' response as the Default. Gets very confusing to ask a negative question and answer with a 'Yes' to result the opposite meaning of the intended question. See I told you it's confusing!
 
Upvote 0
If vbYes = MsgBox("My Question", vbYesNo + vbDefaultButton2, "Confirm Answer") Then
To get a true negative unless you clicked on "Yes", I used
VBA Code:
If vbYes <> MsgBox("My Question", vbYesNo + vbDefaultButton2) Then
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,728
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top