Probably the most annoying thing in VBA coding is that the editor (VBE) looks like the time stopped for him a while ago. Unfortunately it is true in some case, because as far as I know Microsoft stopped to support VBA in 2008, but officially they did not say that until 2020. The case is not only the appearance, but most of all about functionality. In this article I’m going to present 5 VBE upgrades, which will customize your VBA editor to improve your user experience.
Some of the upgrades or tips You probably know, some of them not. Anyway I want to show all of them, so maybe this post will be continued in the next one. Time will show.
If You are not a big fan of reading and just want to watch and listen, go to video at the bottom of this post.
1.Auto Syntax Check
The first thing in this article is Auto Syntax Check. This function stands for the messages with errors and their short description. It pops up every time You make an error like not finishing the code line.
In general it is really useful, but only at the beginning of VBA journey. The later, the worse. It is turn on in default. So to turn it off You need to go to Tools/Options in the top menu and then to the Editor tab.
The first check box below Code Settings stands for Auto Syntax Check. Uncheck it to get rid off those annoying message boxes. Instead of this:
You got only red marked code:
2.Require Variable Declaration
In the same tab in Options You can find also Require Variable Declaration checked. Make sure You got this checked to avoid any kind of issues connected with lack of variable declaration.
The simplest example why it is worth to do, I mean to put a pressure on variables declaration, is that if You don’t declare the VBE is setting variable as Variant – the heaviest type of variable in VBA. Thanks to declarations, You decrease the size of variables few times, which in the end goes to much faster work of your code.
Having this ON every time You insert new module at the top of blank block appears statement, which is telling You about this function.
3.Colors of VBE
The third thing I want to include here is the colors of your code!
You don’t have to work in VBE with white background. You can set it up just the way You like. I would like to show You my favourite colors setting, which I prefer to work with.
Choose the Editor Format tab in Options and there choose specified down below positions from Code Colors and colors for them as I showed it on the pictures.
Thanks to the new settings You can work now on dark background, which can help your eyes during long sessions of coding.
4.Comment/ Uncomment Block
The fourth thing I want to mention here is Comment/ Uncomment Block. To comment the line of code just put the apostrophe in front and this is it. But there are situations, when You want to comment out whole block of the code.
The other day I put apostrophe line by line and then, wanted to bring it back I erased them, also line by line. But there is hidden functionality in the editor already. You can just simply select whole block of code and click Comment Block to comment it out.
You can find Comment Block option in the Edit tab in the top menu. If You want to have this function on top just customize the menu and find this function in the Commands tab.
To reverse comment effect just simply choose Uncomment Block. Just one click to do all this.
5.Definition & Last Position
The last thing I prepared for this article is Definition & Last Position. This will help You to move between your subs and functions in the code. When You see that there is used any of these, instead of CTRL + F to find this routine in the module or whole project, You can just right click on the name of it and choose Definition. After that, when You saw everything and want to go back to the place where You have been, simply right click and choose Last Position.
Those functions are in the View tab in top menu.
To have it on top You can also customize top menu and find this as show on picture above.
But this is not all
That was just 5 choosen upgrades, it’s not all what VBA editor (VBE) keeps from You to customize. If You are not a big fan of reading I invite You to my video on my Youtube channel, when I’m talking and presenting all from above. You can choose just the way You like.