Variables
Variables
VBA - Variables
Variable is a named memory location used to hold a value that can be changed during
the script execution. Following are the basic rules for naming a variable.
You can't use a space, period (.), exclamation mark (!), or the characters @, &, $,
# in the name.
Syntax
Data Types
There are many VBA data types, which can be divided into two main categories, namely
numeric and non-numeric data types.
Byte 0 to 255
https://www.tutorialspoint.com/vba/vba_variables.htm 1/3
9/27/24, 1:44 AM VBA - Variables
Example
https://www.tutorialspoint.com/vba/vba_variables.htm 2/3
9/27/24, 1:44 AM VBA - Variables
password = "Admin#1"
MsgBox "Passowrd is " & password & Chr(10) & "Value of num is " &
num & Chr(10) & "Value of Birthday is " & BirthDay
End Sub
Output
Upon executing the script, the output will be as shown in the following screenshot.
Explore our latest online courses and learn new skills at your own pace. Enroll and
become a certified expert to boost your career.
https://www.tutorialspoint.com/vba/vba_variables.htm 3/3