[values from validation list]

  • Thread starter Thread starter Karol_tom
  • Start date Start date
K

Karol_tom

Hello,

I want use Userform where user can choose only values which are in
validation list for this cell.

How I can do it (get all values from validation list into listbox) ?
 
If the list for the cell is in a range, you could use that as the .rowsource
property. Or load the values into an array and use that.

For instance, I created a small userform with a combobox. And I named my
data|validation list myList (and it is on Sheet1).

This is the code behind the userform:

Option Explicit
Private Sub UserForm_Initialize()
With Me.ComboBox1
.Style = fmStyleDropDownList
.List = Worksheets("sheet1").Range("myList").Value
End With
End Sub

I could have used this, too:

Option Explicit
Private Sub UserForm_Initialize()
With Me.ComboBox1
.Style = fmStyleDropDownList
.RowSource = _
Worksheets("sheet1").Range("myList").Address(external:=True)
End With
End Sub
 
Back
Top