excel-vba VBA Best Practices Use VB constants when available

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

If MsgBox("Click OK") = vbOK Then

can be used in place of

If MsgBox("Click OK") = 1 Then

in order to improve readability.


Use Object Browser to find available VB constants. View → Object Browser or F2 from VB Editor.

enter image description here

Enter class to search

enter image description here

View members available

enter image description here



Got any excel-vba Question?