Combo boxes VBA

K

Kandi

I have 15 combo boxes named combo1, combo2, combo3 etc. How can I cycle
through a loop to access the properties of the of the selected items. These
are not the only objects on the sheet. On the PC using activex it is a
breeze. You use a string for the name and concatenate the name then use the
name to select the object. Mac is unfamiliar territory so it is a bit more
difficult. Also could someone suggest a good book on VBA for Mac Office 2004?
Thanks,
Kandi
 
J

JE McGimpsey

Kandi said:
I have 15 combo boxes named combo1, combo2, combo3 etc. How can I cycle
through a loop to access the properties of the of the selected items. These
are not the only objects on the sheet. On the PC using activex it is a
breeze. You use a string for the name and concatenate the name then use the
name to select the object.

One way:

Dim sCombo As String
Dim i As Long
sCombo = "combo"
For i = 1 to 15
Activesheet.Dropdowns(sCombo & i).Select
Next i

though I almost never select an object, preferring to work with it
directly:

ActiveSheet.Dropdowns("Combo" & i).Value = 3

Mac is unfamiliar territory so it is a bit more difficult. Also
could someone suggest a good book on VBA for Mac Office 2004?

There's almost nothing unique to Mac VBA. Mac VBA is version 5 (roughly
equivalent to WinXL97), so any WinVBA book will be largely applicable,
except for the new items in VBA6 (e.g., the Replace() method, Split(),
Join(), etc). My favorite VBA Book is any of the "Power Programming"
series by John Walkenbach. The 2003 version is pretty good, and 90%
applicable to Mac. Previous versions may save you a few bucks.

Forms controls work in WinXL as well as MacXL, and are accessed the same
way.

For the few Mac-specific differences, look at XL/VBA Help for the
difference between Win and Mac XL VBA.
 
B

Bob Greenblatt

I have 15 combo boxes named combo1, combo2, combo3 etc. How can I cycle
through a loop to access the properties of the of the selected items. These
are not the only objects on the sheet. On the PC using activex it is a
breeze. You use a string for the name and concatenate the name then use the
name to select the object. Mac is unfamiliar territory so it is a bit more
difficult. Also could someone suggest a good book on VBA for Mac Office 2004?
Thanks,
Kandi
If they're activex, you are out of luck. Active X is not supported on the
Macintosh. However, if they are controls from the forms tool bar (which will
work fine on both Mac and Windows), and if you haven't renamed them,
they're called "Drop Down x" where x is an integer.
 

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

Top