I am trying to display the text Select by default in a form control combo box
. I have tried the following but doesn't seem to work. Can someone please suggest what am I doing wrong ?
Option 1:
Activesheet.shapes("choose_selection").text = "Select your choice"
Option 2:
Activesheet.shapes("choose_selection").controlformat.text = "Select your choice"
but I get this error
Set the default value in a combo box
The ListIndex property sets the currently selected item using an index number. ListIndex = 1 sets the first value in the array.
Sub ChangeSelectedValue()
With Worksheets("Sheet1").Shapes("Combo Box 1")
.List = Array("select your choice","Apples", "Androids", "Windows")
.ListIndex = 1
End With
End Sub
Hope it would help.
Try first defining the DropDown
object, and later on display the text in it.
Note : DropDown
is the VBA object that refers to Form_Control ComboBox
.
Dim drpdown As DropDown
' set the drop-down object
Set drpdown = ActiveSheet.DropDowns("choose_selection")
' modify the drop-down properties
With drpdown
.Text = "Select your choice"
End With
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.