Can an array be declared as a constant?

You could use a function to return the array and use the function as an array.

Function ContantArray()
    ContantArray = Array(2, 13, 17)
End Function

enter image description here

enter image description here


How about making it a function? Such as:

Public Function myConstant(ByVal idx As Integer) As Integer
    myConstant = Array(2, 13, 17, 23)(idx - 1)
End Function

Sub Test()
    Debug.Print myConstant(1)
    Debug.Print myConstant(2)
    Debug.Print myConstant(3)
    Debug.Print myConstant(4)
End Sub

Nobody can change it, resize it, or edit its content... Moreover, you can define your constants on just one line!