Like other high level
programming language, one can create aliases in Excel VBA. For example, C
has #define statement to define and create an alias. Other programming
languages too have such statements to support
alias creation.
In C–code, if #define A 100 is present, it directs compiler to replace A with 100 in the entire code.
In excel, such functionality is provided by const statement.
Const A=100
Now everywhere in the code irrespective of the kind of operation, A will represent 100.
Alias make our code more
readable as well as give a clearer and cleaner look. If some value like
date, name is repeated number of times in a code and change is
inevitable, better we replace them with alias.This will save time and ease our work.
In case on wish to make alias and its value visible across all module, do the following.
Public Var_Name as Var_Type
Const Var_Name = Value
The above process can be carried out in a single line.
Public Const Var_Name as Var_Type = Value
Happy VBA..ing