ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting dropdown menu to default value (https://www.excelbanter.com/excel-programming/376613-setting-dropdown-menu-default-value.html)

[email protected]

Setting dropdown menu to default value
 
I am using a series of dropdown menus in a userform.

Is there a way to set the value of a dropdown menu to a default.


Nick Hodge

Setting dropdown menu to default value
 
How about setting the value when you initialise it to one of the options.
The code below uses the userform_initialize event which adds 10 items
(testx) to the combobox and then shows the form with Test6 selected

Private Sub UserForm_Initialize()
Dim x As Integer
For x = 1 To 10
ComboBox1.AddItem ("Test" & x)
Next x
ComboBox1.Value = "Test6"
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England

HIS
www.nickhodge.co.uk

wrote in message
oups.com...
I am using a series of dropdown menus in a userform.

Is there a way to set the value of a dropdown menu to a default.





All times are GMT +1. The time now is 03:13 PM.

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