VBA Programming is an art, not a science

Visual Basic for Applications
 (VBA for short) is actually quite an interesting activity for people like me, for whom it is really an art, and not a science. Why, did I hear you ask? Well, because the one thing that I have learnt in my experience of more than 15 years is that it is very important to name your controls in such a way that repetitive referencing becomes a breeze. For example, if I am creating a userform with four fields represented by textboxes, I would name them as follows:

Address1 txtAddress1
Address2 txtAddress2
Address3 txtAddress3
Address4 txtAddress4

The reason for doing this is very simple, if I had to code the above, I would create a class called “clsAddress” with the following code:

Set clsAddress.Address1 = Userform1.txtAddress1
Set clsAddress.Address2 = Userform1.txtAddress2
Set clsAddress.Address3 = Userform1.txtAddress3
Set clsAddress.Address4 = Userform1.txtAddress4

And to put the fields back into the used database after the editing is over, one could use:

Set/Let Database.Address1 = clsAddress.Address1
Set/Let Database.Address2 = clsAddress.Address2
Set/Let Database.Address3 = clsAddress.Address3
Set/Let Database.Address4 = clsAddress.Address4

See, wasn’t that the simplest thing ? Better still, I will share my trade secret with you in the form of the image below:


This is an actual screen shot of a worksheet in the very file that I intend to use the aforesaid code!! Imagine the possibilities that I can have at my disposal to simplify my coding!!

09-Mar-2017 | 23:32 Hours IST

Beginner’s Course on VBA-Excel


Announcing for the first time in the city of #Ahmedabad, the above course to be conducted by CA Vikram Shankar Mathur with effect from January 1st, 2017. Currently, it is proposed to be held at the aforesaid premises only, to be extended, possibly in the form of webinar’s in the future, depending on the success of the aforesaid #event. The same has also beein simultaneously announced at our FB-VSMathurCo profile and the CA Vikram Shankar Mathur – Live Page on Facebook. Cheers !! Contact us at DeadlyVBAProgrammer@outlook.com for further details.

CA Vikram Shankar Mathur (DVBP)

PS: You can now make the payment for the aforesaid course by simply scanning the QR Code in this picture (or, alternatively enter the mobile number provided) to securely and instantly make the payment online!!


Pay by either scanning the QR Code or by entering the Mobile Number provided.

Pay by either scanning the QR Code or by entering the Mobile Number provided.


01-Jan-2017 | 21:43 Hours IST | #CAVSM |