View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default combo box or list

You will need 3 lists and 2 listboxes. In column A list the building letters
(A & B), column B list the A apartment numbers, column C the B apartment
numbers. Create listbox1 from the Control Toolbox. Select it's properties
and make the ListFillRange A1:A2. From the same Control toolbox make a
listbox2. Do nothing to it. Select listbox1, right-click and select View
Code. It should display a code window with
Private Sub ListBox1_Click() already there. Put the following code to make
it look like this:

Private Sub ListBox1_Click()
If ListBox1.Value = "A" Then
ListBox2.ListFillRange = "B1:B16"
Else
ListBox2.ListFillRange = "C1:C8"
End If
End Sub

Close the code window, click the little triangle button to get out of design
mode to activate your listboxes.
Mike F
"dov" wrote in message
...
Hello,

I am a very beginner in Macros for excel.

We have an excersize: to buildings, A bilding and B building, A have
tenants
from A1 to A16 and B building have B1 to B8, how can I do alist Box or
combo
box so the user can choose building and then apartment number. Thank you,
Dov