Hi,
it is basically the same, instead of <= you would use just = and ommit the parenthesis.
Way #1
Dim a(10) As Long = 2, 4, 6, 8, 10, 12, 42, 99
Way #2
Long a(10) = 2, 4, 6, 8, 10, 12, 42, 99
Way #3 - after array is declared
a(1) = 2, 4, 6, 8, 10, 12, 42, 99
There is problem in your code at line:
Dim s As String
s = a(2) + a(5) ' result: 14
... this will not result in 14, because you assign to string. That means the array values will be converted to string first, behaving as "4" + "10", resulting in "410".
To do what you need, you should use:
Dim s As String
s = Format$(a(2) + a(5)) 'result: 14
Petr
Bookmarks