Keeping your code clean, with lots of comments, no unnecessary code makes it much easier to organize and understand what’s in it, it even make it easy to see any specific snippets you want to change.
For a Portuguese version of this post, click here.
But if you are already familiar with using macros in Excel, this should not be new to you, you may have learned this by trial and error.
But there is one other trick you can do that helps a lot in reading the code, besides making your eyes less tired with that all-white screen. What you can do is change the color scheme of the VBA editor to make it easier to look at.
Before proceeding keep in mind that Excel does not have a ‘Restore Default’ button for these changes which we will see below, so if you want to return to the previous settings you will have to do this manually.
Changing VBA code color
To make changes open the editor (Alt + F11).
In the main menu above, look for Tools and then Options.
In the window that will open go to the second tab, called Editor Format. As soon as it opens you will notice right away that you can change the font and font size that are displayed in the editor, which already helps a lot. But in the little menu on the left, Code Colors, there is a bunch of settings that can be changed to the editor’s colors that make reading the code a lot easier.
Feel free to make the changes you find most convenient, but I’ll leave the configuration I use below.
Setting VBE Colors
I’ll show you the color setting options one by one, as I use here.
Syntax Error Text
Execution Point Text
Call Return Text