Formatting Tools
Proper code formatting is essential to prevent errors and increase readability. AutoVBA has several VBA formatting tools available:
- Comment / Uncomment multiple lines at once
- Automatically apply proper code indentation
- Remove excess blank lines
In the Misc. Utilities page you'll find two other tools that might also qualify as "formatting" tools:
- Sort code
- Show line numbers in the coding module.
Comment / Uncomment Multiple Lines of Code
What does it do?
The comment / uncomment feature allows you to quickly comment or uncomment multiple lines of code at once. The feature is smart enough to identify when some lines of code are commented and others are not, so if you have a block of partially commented code, you can quickly standardize the commenting.
How to access it?
- Via the button on the Code Tools toolbar:
- Highlight one or more lines of code and right-click:
- Keyboard Shortcut: CTRL + ALT + C
Auto Indent
What does it do?
Auto Indent adds proper code indentation to the active module.
Proper indentation makes your code easier to read and reduces the chances of errors.
By default the code indentation will indent all code one "tab" to start. This setting can be changed in the Settings Menu:
How to access it?
Via the buttons on the Code Tools toolbar:
and via the right-click menu:
Remove Excess Linebreaks
Often when coding, blank lines can accumulate. The remove Excess Linebreaks tool scans your active code module and deletes blank lines whenever more than two consecutive blank lines are found.
Use this in conjunction with the Auto Indent tool to quickly clean up your code.
How to access it?
Via the buttons on the Code Tools toolbar:
and via the right-click menu:
Auto Indent(Code Beautify), Display Line Numbers, Sort Code
AutoVBA contains a full suite of coding utilities, including the ability to display line numbers.