Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners
to code procedures from scratch with minimal coding knowledge and with many time-saving features for
This VBA code formatter allows you to easily beautify your code by auto-indenting and cleaning up excess line breaks. You can also "Pretty Print" your VBA code to a PDF for documentation or for easier review.
Step by Step Instructions to Format Code
Copy and Paste your VBA Code into into the "VBA Input" area on the left
Press the 'Indent' button in the middle of the screen. Your new "beautified" code will appear on the right.
Change the code indentation options in the middle of the screen. Your changes will be reflected in real-time
Copy and Paste your VBA code back into the VBA Editor.
This tool will automatically indent your code based on your choosen indentation settings:
Indent Entire Procedure Body - Will all code in procedure be indented one spot or not?
Indent First Comment Block in Procedure - The first comment block is often used to document the procedure functionality. Do you want to indent this or not?
Indent First Declaration Block in Procedure - Do you want to indent the first block of variable declarations?
Indent Case in Case Select - Do you want to indent Case's within a Case Select Statement?
And Based on the following Code Alignment Options:
Align Variable **type** in Variable Declarations - This aligns the variable types in lines with variable declarations - it can make your code easier to read.
Align Comments with Code - If unchecked, comments will by un-indented
Align Line Continuations - Used with the line continuation symbol "_" to extend a line
VBA Code Cleaner
The VBA Indenter can also clean your code by removing excess line breaks. Excess line breaks are when there are more than two consecutive blank lines.
VBA Pretty Print
After you format your VBA Code, you can elect to Pretty Print your code to a PDF. Pretty printing generates a PDF of your VBA code with the standard VBA syntax highlighting, allowing you to easily review your code.
VBA Auto-Indentation Add-in
We also offer a VBA Code Indenter Add-in. The indentation tool is free to use. However, the add-in also offers many premium features: