Spreadsheet.NumericDateOperation

This function is date operation from numeric variables to date variable.

Syntax Parameters Return Value
Sub Spreadsheet.NumericDateOperation( _
    varOfInterest As Variant, _
    dayVar As Variant, _
    monthVar As Variant, _
    yearVar As Variant, _
    dateMethod As DateOperationDateMethod, _
    Optional fmtStr As String = "")
  • varOfInterest [in]

The variable of interest. If create mode is selected the resulting date will be stored here. If split mode is selected this will be the source variable for the date split.

Type: Variant

  • dayVar [in]

Variant value specifying where to get/set day variable. Operation is dependent on which date method was specified.

Type: Variant

  • monthVar [in]

Variant value specifying where to get/set month variable. Operation is dependent on which date method was specified.

Type: Variant

  • yearVar [in]

Variant value specifying where to get/set year variable. Operation is dependent on which date method was specified.

Type: Variant

  • dateMethod [in]

Which date method to use.

Type: DateOperationDateMethod

  • fmtStr [in]

The display format of the created date variable.

Type: String

Default value: ""

This function does not return a value.

SVB Example

Combining date variables:

Option Base 1
Option Explicit
Sub Main
    Dim spr As Spreadsheet
    Set spr = Spreadsheets.Open(Path & "\Examples\Datasets\heart.sta")
    'creates a date variable from three other variables, the day is retrieved from
    'variable2, the month from variable1, and the year from variable3
    'the new date is placed into variable 5 and displayed using the windows date format
    spr.NumericDateOperation(5,2,1,3,scDateCreate,"[WINDOW DATE FORMAT]")
    spr.Visible = True
End Sub