简体   繁体   中英

Making a Multi-line Array in Excel VBA?

I'm trying to make a multi-line array variable, but it's not working for some reason and I can't work out what I am doing wrong...

The following array works correctly:

aInter = Array("Item 1", "Item 2", "Item 3", "Item 4", "Item 5")

However, when I try and make a multi-line array using the line continuation & _ it doesn't let me

I've tried various ways:

aInter = Array("Item 1", "Item 2", "Item 3" & _
"Item 4", "Item 5")

aInter = Array("Item 1", "Item 2", "Item 3", ) & _
("Item 4", "Item 5")

aInter = Array("Item 1", "Item 2", "Item 3") & _
("Item 4", "Item 5")

What's the correct way of doing it?

The correct way is:

aInter = Array("Item 1", "Item 2", "Item 3", _
    "Item 4", "Item 5", _
    "Item 6", "Item 7")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM