Programming a macro in excel 2010 What am I doing syntactically that is causing the error?
Error message says:
Compile error: Expected: end of statement
Code:
Dim myArray = New String() {"A", "B", "C", ... continues to..."Z" }
Programming a macro in excel 2010 What am I doing syntactically that is causing the error?
Error message says:
Compile error: Expected: end of statement
Code:
Dim myArray = New String() {"A", "B", "C", ... continues to..."Z" }
looks like you are using some other language construct, try simply this (assumes you know in advance how long the array needs to be, and that you know in advance the values to assign to the array:
Dim myArray() As String
myArray = Split("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z", ",")
If you don't know the values in advance, the approach might need to be different using iteration/etc.
Note: arrays are typically base 0 in vba, this example makes it base 1.