Hi all -
I have a userform with a combo box linked to a dynamic range. I want to limit the size of the combo box to the number of entries in the range to prevent users from clicking on a blank space and causing an error. The combo box is filled during the form initialization using the following code:
[pre]
[/pre]
But when I run the for, the combo box drop down always has 3 or 4 more spaces than I have entries. When one of those spaces is clicked (even though I don't know why a user would do this), I get a Ru-time error 13, Type mismatch. Am I doing something wrong or is there a better way to implement this?
I appreciate any help you can provide. Thanks.
I have a userform with a combo box linked to a dynamic range. I want to limit the size of the combo box to the number of entries in the range to prevent users from clicking on a blank space and causing an error. The combo box is filled during the form initialization using the following code:
[pre]
Code:
Dim wkSal As Worksheet
Set wkSal = Worksheets("Salaries")
For Each rName In wkSal.Range("Names")
With Me.cboReview
.AddItem rName.Value
.List = Range("Names").Value
.ListRows = Range("Names").Rows.Count
End With
Next rName
But when I run the for, the combo box drop down always has 3 or 4 more spaces than I have entries. When one of those spaces is clicked (even though I don't know why a user would do this), I get a Ru-time error 13, Type mismatch. Am I doing something wrong or is there a better way to implement this?
I appreciate any help you can provide. Thanks.