• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Format Source in VBA

guirmaia

New Member
Hi everyone,
I want to format my VBA code. Is any way to do it automatically ?

Example what I have:

Code:
Sub Calcular()

Application.ScreenUpdating = False

With ActiveSheet

h = .Range("F19")

If Not WorksheetFunction.IsNumber(h) Then

.Range("F19").Select

MsgBox "Altura não é um número válido.", vbInformation, "Nota"

Exit Sub

What I want:

Code:
Sub Calcular()

Application.ScreenUpdating = False

With ActiveSheet

  h = .Range("F19")

  If Not WorksheetFunction.IsNumber(h) Then

      .Range("F19").Select

      MsgBox "Altura não é um número válido.", vbInformation, "Nota"

      Exit Sub

  End If

End Sub

This is just a few rows, but for a code like 140 rows to do one by one is frustrating...

<Mod Edit: Please nest your code in code tag, using insert tool>
 
Last edited by a moderator:
Do a google search on VBA Code Formatter

There are a number of Excel addin's that can help you do that

Here is an online version

78893
 
Back
Top