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?

comments / uncomment before and after

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?

  1. Via the button on the Code Tools toolbar:
    1. comments / uncomment multiple lines of code
  2. Highlight one or more lines of code and right-click:
    1. comments / uncomment multiple lines of code
  3. Keyboard Shortcut: CTRL + ALT + C

Auto Indent

What does it do?

auto indent before after

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:

settings toolbar

settings menu

How to access it?

Via the buttons on the Code Tools toolbar:

linebreaks toolbar

and via the right-click menu:

linebreaks right-click

Remove Excess Linebreaks

remove excess line breaks before after

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:

linebreaks toolbar

and via the right-click menu:

linebreaks right-click

Auto Indent(Code Beautify), Display Line Numbers, Sort Code

AutoVBA contains a full suite of coding utilities, including the ability to display line numbers.

linebreaks toolbar