Expand Minimize

Must be first statement on the line

Last modified: December 06, 2011

Applies to: Office 2013 | VBA

Not all keywords can appear at the beginning of a line of code. This error has the following causes and solutions:

  • You preceded a Sub, Function, or Property statement with another statement on the same line. A Sub, Function, or Property statement must always be the first statement on any line in which it appears (unless preceded by the keyword Public, Private, or Static).

  • You preceded an End If, Else, or ElseIf statement with another statement on the same line. An End If, Else, or ElseIf (only when used in a block If structure) statement must always be the first statement on any line in which it appears.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

Show:
© 2015 Microsoft