Search notes:

VBA statement: option base

option base specifies the default number for the first element in an array.

Simple demonstration

The following three VBA modules try to demonstrate the effect of option base on the creation of arrays:

without.bas

Without an explicition option base statement, arrays are created with their first index being 0.
option explicit

function arrayWithoutOptionBase() as variant() ' {

    arrayWithoutOptionBase = array(0, 1, 2, 3)

end function  ' }

with.bas

The following module specifies option base 1. So, arrays, by default, are created with their first index being 1.
option explicit
option base 1

function arrayWithOptionBase() as variant() ' {

    arrayWithOptionBase = array("one", "two", "three", "four")

end function  ' }

run.bas

The driver program calls the two functions and then checks the range of their indexes with the lBound and uBound functions.
option explicit

sub main() ' {

    dim array_0() as variant
    dim array_1() as variant

    array_0 = arrayWithoutOptionBase
    array_1 = arrayWithOptionBase

    debug.print "array_0 starts with index " & lBound(array_0) & " and ends with index " & uBound(array_0)
    debug.print "array_1 starts with index " & lBound(array_1) & " and ends with index " & uBound(array_1)
    debug.print ""
    debug.print "array_0(2) = " & array_0(2)
    debug.print "array_1(2) = " & array_1(2)

end sub ' }
'
' Program writes
'
'   array_0 starts with index 0 and ends with index 3
'   array_1 starts with index 1 and ends with index 4
'
'   array_0(2) = 2
'   array_1(2) = two

See also

VBA statements

Index