Free since 2005 · No login required
AT

Academic Tutorials

Learn at your own pace

site-mobile-top-banner · 320x50

How Do I Declare Variables?

You may declare variables implicitly, meaning that you don't need to declare variables prior to their use and can just type something like: myVar = 9. However, this is very bad practice that can result in a number of inexplicable errors. To explicitly declare a variable use either the Dim, Public, or Private statements. Providing better security, all variables are of the Visual Basic Variant datatype, meaning that the variable can contain a wide array of datatypes. To define a variable named myVar and assign it a value of 10