View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Userform, ComboBox, and Workbooks... Oh my!?

One way:

Depending on how the data is laid out in a single sheet in that
workordermltestbk workbook, you could use =match() to find the match and
retrieve the other values.

Sub Commandbutton1_click()
dim res as variant
dim WOWks as worksheet
dim WOLookupRng as range

set wowks = workbooks("workordermltestbk").worksheets("sheet99 99")

with wowks
set wolookuprng = .range("A:A")
end with

if me.combobox1.value = "" then
'nothing entered
exit sub
end if

res = application.match(me.combobox1.value, wolookuprng, 0)

if iserror(res) then
'no match, what should happen?
beep
else
me.textbox1.value = wolookuprng(res).offset(0,1) 'column B
me.textbox2.value = wolookuprng(res).offset(0,13) 'column N
...
end if

end sub

I used the "ok" button to populate the other textboxes. If you (or your users)
are like me, they could choose the wrong item a few times before selecting the
correct one.

(untested, uncompiled. Watch for typos.




fail2excel wrote:

Userform "Customer Orderform" "ComboBox1" I would like to click the arrow,
scroll down find and click on name filling the form with the remaining
customer info that resides in an inactive workbook. The active workbook is
"WorkorderMLTestBK"
Any suggestions are greatly appreciated. Thanks Bill T.


--

Dave Peterson