ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   combo box - VBA form (https://www.excelbanter.com/excel-discussion-misc-queries/258904-combo-box-vba-form.html)

Roy Gudgeon[_2_]

combo box - VBA form
 
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
--
thanks
Roy

Mike H

combo box - VBA form
 
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.


"Roy Gudgeon" wrote:

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
--
thanks
Roy


Mike H

combo box - VBA form
 
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.


"Roy Gudgeon" wrote:

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
--
thanks
Roy


Roy Gudgeon[_2_]

combo box - VBA form
 
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 !
--
thanks
Roy


"Mike H" wrote:

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.


"Roy Gudgeon" wrote:

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
--
thanks
Roy



All times are GMT +1. The time now is 01:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com