tricks of gurus

...The msgbox() function supports multiple arguments in the Style parameter...
~hatman

That's what's so amazingly funny about programming in VBA. Here you've developed this amazing app w/ userforms and literally hundreds of controls and yet you just learned something very basic about MsgBox() of all things. (I just learned of the existance of the VBA function MONTHNAME() a couple of weeks ago.) Personally, I'll also add in the vbDefaultButton2 arg on OKCancel boxes when requesting confirmations on a particularly potent action where I cannot or have not developed an "undo".

Just a note to newbies: when using the vbYesNo and testing the response, you must test against the VB constants, not the XL constants. xlYesvbYes and xlNovbNo.

<h3>Correct</h3>
Code:
If vbYes = MsgBox("Is Hatman a stud?", vbQuestion + vbYesNo + vbDefaultButton2, "Hi, Paul") Then

<h3>Incorrect</h3>
Code:
If xlYes = MsgBox("Is Hatman a stud?", vbQuestion + vbYesNo + vbDefaultButton2, "Hi, Paul") Then
 

Excel Facts

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

Forum statistics

Threads
1,215,949
Messages
6,127,888
Members
449,411
Latest member
AppellatePerson

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