Spreadsheet.AddVariables

This function adds a specified number of variables to the spreadsheet.

Syntax Parameters Return Value
Sub Spreadsheet.AddVariables( _
    Name As String, _
    After As Integer, _
    Optional HowMany As Variant, _
    Optional Type As Variant, _
    Optional Len As Variant, _
    Optional MissingData As Variant, _
    Optional Format As Variant, _
    Optional LongName As Variant)
  • Name [in]

The name of the new variable(s).

Type: String

  • After [in]

Long value specifying after which variable the new variables should be added to.

Type: Integer

  • HowMany [in,optional]

How many variables are to be added. This parameter defaults to 1.

Type: Variant

  • Type [in,optional]

Integer value specify the data type of the variable. The following constants can be used as arguments for this parameter: scDouble, scByte, scInteger, or scText. This parameter defaults to scDouble.

Type: Variant

  • Len [in,optional]

The maximum text length of the variable (if its data type is text).

Type: Variant

  • MissingData [in,optional]

The value to be associated with missing data.

Type: Variant

  • Format [in,optional]

The format of the variable. This parameter defaults to an empty string.

Type: Variant

  • LongName [in,optional]

The long name or function of the variable. This parameter defaults to an empty string.

Type: Variant

This function does not return a value.

SVB Example

Adding cases and variables to a spreadsheet:

Option Base 1
Option Explicit
Sub Main
    Dim spr As Spreadsheet
    'assigns the active spreadsheet to the object spr
    Set spr = ActiveSpreadsheet
    'adds 4 cases to the spreadsheet after case 10
    spr.AddCases(10,4)
    'adds 4 variables to the spreadsheet after variable 10
    spr.AddVariables("New Variables", 10,4, scText, 20)
End Sub