ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to mark an item selected in the Excel VBA Form? (https://www.excelbanter.com/excel-programming/376107-how-mark-item-selected-excel-vba-form.html)

divya

How to mark an item selected in the Excel VBA Form?
 
I made a combobox in a VBA form and I want the user to select only
items from the list but the problem is the default selected item it
shows blank and allows user to add his input into it.
Kindly suggest a solution .I think If I give a default selected value
then the problem will be solved , but how to give the default value?

Regards
Divya


Peter T

How to mark an item selected in the Excel VBA Form?
 
Hi Divya,

try this with just a combobox on the form

Private Sub UserForm_Initialize()
ComboBox1.List = Array("first", "second", "third")
ComboBox1.ListIndex = 1 ' ie 1 is 2nd item
End Sub

See ListIndex in help

Regards,
Peter T

"divya" wrote in message
oups.com...
I made a combobox in a VBA form and I want the user to select only
items from the list but the problem is the default selected item it
shows blank and allows user to add his input into it.
Kindly suggest a solution .I think If I give a default selected value
then the problem will be solved , but how to give the default value?

Regards
Divya





All times are GMT +1. The time now is 02:48 AM.

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