combo box - VBA form

R

Roy Gudgeon

HI

I have created a form via VBA, I have included a combo box which I want to
point at a specific list of entries.

I can do this on a normal worksheet using data validation, how do I do it in
VBA design mode
 
M

Mike H

Hi,

One way

Private Sub UserForm_Initialize()
For x = 1 To 6
ComboBox1.AddItem Worksheets("Sheet1").Cells(x, 1).Value
Next
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
M

Mike H

Maybe neater

Private Sub UserForm_Initialize()
ComboBox1.RowSource = "Sheet1!" & "$A$1:$A$6"
End Sub

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
R

Roy Gudgeon

Thanks Mike

Easy when you know how, appreciate prompt reply and solution.
Sure I'll be back, am still learning and I'm not a quick learner !
 

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