# Awesome Vba Add-in



## GaryR (Apr 9, 2008)

ok,
it's a really simple little thing but i think this is SOO handy! i love it!

http://www.oaltd.co.uk/Indenter/Default.htm

Smart Indenter v3.5
Run it on your completed code and it goes through and corrects all of your indentations and makes all your multi-line code line up

lots of options to control the way it indents and will do just a procedure, just a module, or an entire project at a time!

love it!


----------



## Norie (Apr 9, 2008)

Gary

I've not given the add-in a go, perhaps later.

But one thought - shouldn't you be doing the indenting yourself in the first place?


----------



## GaryR (Apr 9, 2008)

of course you should, but this cleans it all up further just in case. makes it "pretty"

plus it does stuff i don't take the time to do, like line up multiline comments and code lines regardless of operators, such as this

```
MsgBox "This is a message box that uses" & _
           "multiple lines and it will make sure it's all" _
         & "lined up correctly regardless of operators."
```


----------



## GaryR (Apr 9, 2008)

And of course it'll indent all your loops to ease debugging. finally realize you forgot one End If!

```
If a = b Then
        c = d
    Else
        If e = f Then
            g = h
        End If
    End If
    For a = 1 To 2
        For b = 3 To 4
            Cells(a, b).Value = "text"
        Next a
    Next b
```


----------



## Joe4 (Apr 9, 2008)

> But one thought - shouldn't you be doing the indenting yourself in the first place?


I always do, but what about all the code you inherit?  That is where it can really be useful (apparently, the programmer before me didn't believe in indenting or documenting).  Of course, at this point, I have already re-written most of his code anyway...


----------



## Norie (Apr 9, 2008)

jm14

Good point.

But generally what I do when inheriting code is try and find out it's actual purpose.

Then if needed rewrite.

Obviously I'll refer to the original code but there's nothing wrong with starting over.


----------

