Using arrays to create Combobox items

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello out there!
I want to use the same items several times in different comboboxes, i.e.
a currency selection (EUR, USD, SEK, DKK......). There are 7 instances where
the user selects the currency to use (and it can be different currency at
every selection). Instead of reading the list from a sheet or writing the
same ComboboX.AddItem= "EUR" and so on for every new combobox, I wanted to
use an array and a for...next loop that can be used for every combobox
creation. But, arrays are not allowed in for...next statements.
Can it be done in another neat way?
Best regards
Mats
 
Mats

You can assign an array directly to the List property, so no need for
For/Next.

Dim vaCurrency As Variant

vaCurrency = Array("EUR", "USD", "SEK", "DKK")

Me.ComboBox1.List = vaCurrency

Make vaCurrency a global variable and you can use it wherever you want.
 
Thanks Dick!
It helped and was as simple and neat as you could ask for!
Best regards
Mats
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top