ComboBox with horizontal range on an Excel USERFORM

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

Guest

How do you write a source in code in VB Code for a ComboBox3 on an Excel
UserForm where the source is horizontal range. For example Sheet2!E2:H2.
 
dim myCell as range
dim myRng as range

set myrng = worksheets("sheet2").range("e2:h2")

With me.combobox3
for each mycell in myrng.cells
.additem mycell.value
next mycell
end with
 
Hi,

If it's just the contents of the cells required to populate the control
and not be linked then perhaps,

ComboBox1.List = _
Application.WorksheetFunction.Transpose( _
Worksheets("sheet2").Range("e2:h2"))

Cheers
Andy
 
Thank you!!!!!!!!!!!!
--
ca1358


Dave Peterson said:
dim myCell as range
dim myRng as range

set myrng = worksheets("sheet2").range("e2:h2")

With me.combobox3
for each mycell in myrng.cells
.additem mycell.value
next mycell
end with
 

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