User Forms - Combo Boxes

  • Thread starter Michael Excel Dude
  • Start date
M

Michael Excel Dude

I'm designing a user form with Combo Boxes/List Boxes. I have thre
related questions:

1. My combo box shows my list, but allows other input (other than th
value of the lists). How can I restrict entry to the only the choice
on the list?

2. I've set up my combo box with a reference to a range for the bo
values. How do I embed the list values directly in the code instead o
a reference to cells?

3. When the user enters info in the various boxes of the user form, ho
can I show a cell/box within the user-form showing the result of
formula which uses the values entered in the form?

Any help would be appreciated.

Thanks
 
D

Dave Peterson

#1. Make the .style fmStyleDropDownList

#2. Use .additem

Private Sub UserForm_Initialize()

Dim iCtr As Long
With Me.ComboBox1
.Style = fmStyleDropDownList
For iCtr = 1 To 4
.AddItem "A" & iCtr
Next iCtr
End With

End Sub

#3. I wouldn't use the formula in the cell. I'd duplicate the formula in code
and just make sure everything is valid before trying to display the results.
And maybe put a button on the form to "Evaluate This Data" that updates a
Label????
 
Top