View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default ListBox external source

Assume your table/range is in SupplierList.xls on sheet Data, Range:
"A1:B100"

In your sheet,
Select C3 then do

Data=Validation.

You would need to use the List option and set it to

=List1

but do this after you create these names:

after you create a defined name
Insert=Name=Define
Name: List1
RefersTo: =[SupplierList.xls]Data!$A$1:$A$100

and another
Insert=Name=Define
Name: = List2
Refersto: =[SupplierList.xls]Data!$A$1:$B$100

Then in C4 you would have

=if(C3="","",Vlookup(C3,List2,2,False))

SupplierList.xls would need to be open when you use the workbook with these
formulas (at least for the Data=validation to work).

--
Regards,
Tom Ogilvy


"DoctorG" wrote in message
...
In the first sheet of my file I have a cell (C3) that accepts input (a
Supplier code) to be validated against an external Excel file table/range
(Column A). Then C4 displays the Supplier name (Column B). I would like to
have this done by a ListBox in order to guide the user to all available
choices.

Please help me set it up since I have never used User forms (???) and such
Control objects in VBA and I have trouble initializing them. I found in

the
Help system sample code using a user form but I don't use User Forms, not

to
my knowledge anyway. Please bear in mind that the table is external.

Thanks in advance