VBA Const query

What is the difference between the keyword "DIM" and "CONST" and how to use it.

  Devendra Singh

In VBA,  DIM represents VARIABLES however CONST represents CONSTANTS and they work as the nomenclature suggests. In other words, values of variables can change  while as constants have fixed value.

Let me quote an example:  If you have taken a loan that  needs to be repaid within a year with an annual interest rate of 24%. You have a flexibility to replay this loan as per your monthly budgets but must be closed within an year.

Now, if you translate the same into VBA - 24% of interest rate is CONST, however, your monthly instalment is a variable component.

You may also want to go through the below link


  Asheesh Mattoo       22 Jul 2016       0       0     

Post Your Answers:

Please use the CODE HIGHLIGHT Button to format/highlight your codes if any