Ad space (banner)
Lesson 2 / 20

Your first output (MsgBox)

This lesson covers the basics of showing output in VBA with MsgBox.

MsgBox "..." displays a pop-up window on screen. VBA is the language for automating Excel, and code is written in units of work called Subs.

In the sample code, a single line — MsgBox "Hello, VBA!" — sits inside the fixed Sub Hello() ... End Sub frame.

A common early stumble is forgetting Sub and End Sub. Every piece of VBA has to be wrapped in that pair, and leaving one out is an error.

In professional work, VBA macros are used widely across accounting, sales, and many other departments to automate repetitive work in Excel.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run VBA directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)