Home » excel » excel – vba arrays manipulation hard coding syntax

excel – vba arrays manipulation hard coding syntax

Posted by: admin May 14, 2020 Leave a comment

Questions:

hard coding array manipulation in c based languages is common, like below:

int i[] = new i[2][2];
i = {{1,1},{2,2}};

how it could be done in vba scripts?

How to&Answers:

I think you can use the Array() function to build an array of values.

I haven’t tried it, but I suspect you could do what you want with this:

Dim i as Variant
i = Array(Array(1, 1), Array(2, 2))

It’s been a while, so my VBA is a bit rusty.