Skip to main content

statement

A syntactically complete unit that expresses one kind of action, declaration, or definition.

A statement generally occupies a single line, although you can use a colon (:) to include more than one statement on a line. I do not recommend using a colon to put two statements on the same line in VBA.

You can also use a line-continuation character (_) to continue a single logical line onto a second physical line.

colon example:

For i = 1 To 10: ProcessFoo (i): Next
Dim x As Long: x = 1

line-continuation character example:

Private Sub Chart_SeriesChange(ByVal SeriesIndex As Long, _ 
        ByVal PointIndex As Long) 
    Set p = ActiveChart.SeriesCollection(SeriesIndex). _ 
        Points(PointIndex) 
    p.Border.ColorIndex = 3 
End Sub

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>