View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default dynamic fill of listbox - need help

In it simplest form

assume listbox1 and listbox2

Private Sub Listbox1_click()
With Userform1
If .Listbox1.ListIndex = -1 then exit sub
.Listbox2.Clear
With Worksheets("Data")
set rng = .Range(.Cells(2,1),.Cells(2,1).End(xldown))
v = rng.resize(,2).Value
end with
for i = 1 to ubound(v)
if v(i,lbound(v,2)) = .Listbox1.Value then
.Listbox2.AddItem v(i,Lbound(v,2)+1)
end if
Next
End With
End sub

--
Regards,
Tom Ogilvy

"gonger" wrote:


Thanks, Tom. It's going to get a little messy in that I'm trying to do
this in a form, but I'm going to give it a shot.


--
gonger
------------------------------------------------------------------------
gonger's Profile: http://www.excelforum.com/member.php...o&userid=34797
View this thread: http://www.excelforum.com/showthread...hreadid=545541