Hi,
it is basically the same, instead of <= you would use just = and ommit the parenthesis.
Way #1
Way #2Dim a(10) As Long = 2, 4, 6, 8, 10, 12, 42, 99
Way #3 - after array is declaredLong a(10) = 2, 4, 6, 8, 10, 12, 42, 99
There is problem in your code at line:a(1) = 2, 4, 6, 8, 10, 12, 42, 99
... 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".Dim s As String s = a(2) + a(5) ' result: 14
To do what you need, you should use:
Dim s As String s = Format$(a(2) + a(5)) 'result: 14
Petr





Reply With Quote
Bookmarks