• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Creating a Sub Procedure

You can either type a Sub procedure directly into the Modules window, or the Visual Basic Editor can insert it for you. Sub procedures all begin with the line: Sub ProcedureName( ) where ProcedureName is the name of the Sub procedure. If the Sub procedure includes arguments, enter them between the opening and closing parentheses. Not every Sub procedure requires arguments. After entering the first line, which names the procedure, you can insert the procedure's VBA commands. Each Sub procedure ends with the line: End Sub

Create a Sub Procedure

In the Visual Basic Editor, click the Module window to select it.

Click the Insert menu, and then click Procedure.

Enter the procedure's name.

Click the Sub option, if necessary.

Click OK.

The Editor inserts the opening and closing lines of the new Sub procedure.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint