Question: Is following VBA structure correct? "Dim aStroke() As Variant" , aStroke(i) ???
Dim aStroke() As Variant
For i = 1 To 15
aStroke(i) = XXX
Dim aStroke() As Variant is dynamic (unsised) array of variants
you need this
Dim aStroke As Variant
How to Dim aStroke() As ???
I need array to make: aStroke(1), aStroke(2),aStroke(3),aStroke(4),......aStroke(i) for LOOP.
Dim aStroke As VariantSub main()ReDim aStroke(14)For i = 0 To 14
Next i End Sub
Dim aStroke(14) As VariantSub main()
For i = 0 To 14
But in this case I would use same type as XXX instead of variant
Also to build upon Ivana's reply. If you know what type of data you are using (integer, long, single, double, string, etc.) then it is better to declare you variable as that type. Using a variant is slower because VBA must convert it to that data type when using it with other variables. As I understand it, variants should only be used when you do not know what data type is being returned or if an array of unknown size is returned.
Retrieving data ...