MsgBox and InputBox

MsgBox is an internal VBA procedure (method) used to display content within a dialog window that appears on the screen. It can be used to display the operand that we have directly transmitted or the values ​​of the variables that are calculated within the subroutine. InputBox is a function that we use to enter values ​​that we will later use to calculate the expression.

Value assignment

In previous posts you have seen how variable values are assigned and in this text I will look at Variant data type, basic arithmetic as well as some other operations that we can use to calculate desired expressions. I think it will be especially helpful for you to find out how to set the fixed length strings, and how to merge more of them into one.

Custom functions

In the preceding text we talked about procedures and now we will mention functions. Functions are known as subroutines that calculate and return certain values. We can call them from other programs and it is possible to create custom functions that we will later use in worksheets. This is useful when Excel does not have the specific features you need to perform everyday work.

First VBA program

When you create an Excel macro, it automatically defines a new subroutine, which is actually a program that runs after the specified action. You can also create subroutines independently which could be called from other programs, or run in the manner described below. This text will show how a simple code is written and how it is then linked to the objects that are used to launch it.

Variables, data types, constants …

Variables are placeholders within computer memory that are aimed to store values ​​of different types of data, such as: numbers, text, logical values, date/time … Although this is not necessary, for better memory utilization, you need to declare them at the beginning of the program and assign them a data type. Variables that will have fixed values ​​during program execution are called constants.