Here is a simple example using a userform, a combobox and a command button.
You can leave the form open while you work. It inserts an address in the
selected cell when the user click the Insert command button.
'-------------------------------
'standard module
Option Explicit
Sub Main()
UserForm1.Show vbModeless
End Sub
'-----------------------------
'userform module
'with button "cmdInsert"
'and combobox ComboBox1
Option Explicit
Dim col As Collection
Private Sub cmdInsert_Click()
On Error Resume Next
With ComboBox1
ActiveCell.Value = col(.List(.ListIndex))
End With
End Sub
Private Sub UserForm_Initialize()
With ComboBox1
.AddItem "Larry"
.AddItem "Curly"
.AddItem "Moe"
.ListIndex = 0
End With
'Note the names in the list box are used as indexes to the collection
'so that a selected name identifies an address directly.
Set col = New Collection
col.Add "123 Fourth Street, Casper, WY 12345", "Larry"
col.Add "456 Seventh Avenue, Dayton, OH 54321", "Curly"
col.Add "432 First Street, Boise, ID 12321", "Moe"
End Sub
Private Sub UserForm_Terminate()
Set col = Nothing
End Sub
Bob Kilmer
<billabong wrote in message
...
Hi
I would like some help in creating a drop down window were the user
selects a name and an address appears in certain cells. I have tried
creating a userform and adding a listbox but with no luck.
Are there any examples out there similar to this with VB code
Thanks