Situatie
VBA MsgBox function is like an output function used to display the generalized message provided by the developer. It is like a print statement. This function or statement has no arguments. The personalized messages in this function are written under double quotes, while one must provide the variable reference for the values.
Solutie
Pasi de urmat
Enable Developer Tab
Firstly, if you do not see the Developer tab in your excel, follow the steps below to enable it.
Step 1: Go to FILE > OPTIONS.
Step 2: Click on Customize Ribbon under Excel Options.
Step 3: On the right-hand side, check the Developer’s box to enable it.
Step 4: Click on “OK” and close this window. Now, you should see the Developer tab in your Excel ribbon.
How to Create a MessageBox using VBA Code?
Step 1: Open Visual Basic Editor
Go to the DEVELOPER tab and click on VISUAL BASIC.
Step 2: Insert Module
Now, click on INSERT and select MODULE. It will insert the new MODULE in your VBA editor.
Step 3: Start Subprocedure
Start your excel macro by typing SUB, the head of the macro. Give a MACRO a name and press the “Enter” key.
Step 4: Start Writing Code for MsgBox
- In between the Head & Tail of the macro, we need to write the code. So start the word Msgbox. It will display the MsgBox function.
- As soon as you see the word Msgbox press tab, it will start to show the Msgbox syntax.
- Now, type the word Welcome to VBA in double-quotes.
Run the Code
Now inside the macro, place a cursor and press the key F5, the shortcut key to run a macro.
Leave A Comment?