by Dinesh Thakur Category: Variables and Constants

1. There are several ways of declaring the variable, the most commonly used statement is Dim statement to declare the variable. The syntax for declaring the variable using Dim is as follows:


Dim Identifier [As Data type]


2. The reserved word Dim is really short for dimension, which means ‘Size’. When you declare a variable, the amount of memory reserved depends on its data type.


3. In the Dim statement [as data type] is optional. If you omit that statement the default data type is applied to the variable.


4. Example for using Dim statement:


Dim strName as String                       ‘Declared the String variable

Dim intCounter as Integer                   ‘Declared an Integer variable

Dim curDiscount as Currency            ‘Declared a currency variable

Dim vntChanging                                ‘Default variant data type


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.