Two ways to automatically indent VBA code
Having your code follow generally accepted indentation rules makes it easier to understand and debug.
With the Code VBA 'indentation' feature you can have your code indented automatically and indented on request.
Automatic indentation
Automatic tidying of a procedure's code indentation is done when you move out of the procedure you have been editing. This feature requires you to have the preference 'Auto indentation when exiting a procedure' checked:

Below it, the other option allows you to specifiy if commented lines are to be aligned with the code. If not, they keep whatever position they have.

Indentation on request
If in a certain project you have code that is not indented well, you can have individual procedures or a complete module indented from the Code Explorer menu