The next subroutine uses several variables. All variables must be declared before the subroutine can access them.
Const pi = 3.14159:
In the VBA IDE, enter the following code in the Code window, immediately after the linePrivate sp(0 To 2) As Double
Private ep(0 To 2) As Double
Private hwidth As Double
Private trad As Double
Private tspac As Double
Private pangle As Double
Private plength As Double
Private totalwidth As Double
Private angp90 As Double
Private angm90 As Double
Now look at the two drop-down lists at the top of the Code window. These lists are called the Object Box and the Procedure/Event Box and currently display the terms (General) and (Declarations), respectively. These lists display the current section of the code you are working in, and enable you to move quickly to a different section by simply selecting one from the list. The (Declarations) section is the appropriate place to declare variables that you will use in more than one subroutine.